Page 1 of 1

Vector To Rotation

Posted: Wed Feb 06, 2019 6:27 pm
by NeonTiger
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;