Vector To Rotation

Scripts and code that enhance the gameplay functionality of the engine.
1 post Page 1 of 1
NeonTiger
Posts: 8
Joined: Sun Aug 02, 2015 4:50 am
by NeonTiger » Wed Feb 06, 2019 6:27 pm
Just a useful function for vector math.

Drop it at the bottom of mathTypes.cpp
DefineConsoleFunction(createOrientFromDir, const char*, ( VectorF vec),,"Returns orientation from a vector input")
{
	MatrixF mat = MathUtils::createOrientFromDir(vec);
	AngAxisF aa(mat);
	char* ret = Con::getReturnBuffer(256);
	dSprintf(ret, 255, "%g %g %g %g", aa.axis.x, aa.axis.y, aa.axis.z, aa.angle);
	return ret;
}
1 post Page 1 of 1

Who is online

Users browsing this forum: No registered users and 2 guests