MCPcopy Create free account
hub / github.com/TorqueGameEngines/Torque3D / getMatrixFromForwardVector

Function getMatrixFromForwardVector

Engine/source/math/mathUtils.cpp:237–252  ·  view source on GitHub ↗

Source from the content-addressed store, hash-verified

235//-----------------------------------------------------------------------------
236
237void getMatrixFromForwardVector( const VectorF &forward, MatrixF *outMat )
238{
239 AssertFatal( forward.isUnitLength(), "MathUtils::getMatrixFromForwardVector() - Forward vector was not normalized!" );
240 AssertFatal( outMat, "MathUtils::getMatrixFromForwardVector() - Got null output matrix!" );
241 AssertFatal( outMat->isAffine(), "MathUtils::getMatrixFromForwardVector() - Got uninitialized matrix!" );
242
243 VectorF up = mPerp( forward );
244 VectorF right = mCross( forward, up );
245 right.normalize();
246 up = mCross( right, forward );
247 up.normalize();
248
249 outMat->setColumn( 0, right );
250 outMat->setColumn( 1, forward );
251 outMat->setColumn( 2, up );
252}
253
254//-----------------------------------------------------------------------------
255

Callers 2

setDirectionMethod · 0.85
_updateDecalMethod · 0.85

Calls 6

mPerpFunction · 0.85
isUnitLengthMethod · 0.80
isAffineMethod · 0.80
setColumnMethod · 0.80
mCrossFunction · 0.70
normalizeMethod · 0.45

Tested by

no test coverage detected