mirror of
https://github.com/TorqueGameEngines/Torque3D.git
synced 2026-02-13 11:43:49 +00:00
Adds the getSignedAngleBetweenVectors function, which is like the existing getAngleBetweenVectors, but will returned a signed angle value, which helps to inform the full 360 angle, rather than the 'nearest 180'.
This commit is contained in:
parent
5c8a82180b
commit
c2c34cdd5d
3 changed files with 34 additions and 0 deletions
|
|
@ -373,3 +373,20 @@ DefineConsoleFunction( mGetAngleBetweenVectors, F32, (VectorF vecA, VectorF vecB
|
|||
{
|
||||
return MathUtils::getAngleBetweenVectors(vecA, vecB);
|
||||
}
|
||||
|
||||
DefineConsoleFunction(mGetSignedAngleBetweenVectors, F32, (VectorF vecA, VectorF vecB, VectorF norm), (VectorF::Zero, VectorF::Zero, VectorF::Zero),
|
||||
"Returns signed angle between two vectors, using a normal for orientation.\n"
|
||||
"@param vecA First input vector."
|
||||
"@param vecB Second input vector."
|
||||
"@param norm Normal/Cross Product vector."
|
||||
"@returns Angle between both vectors in radians."
|
||||
"@ingroup Math")
|
||||
{
|
||||
if (vecA.isZero() || vecB.isZero() || norm.isZero())
|
||||
{
|
||||
Con::errorf("mGetSignedAngleBetweenVectors - Error! Requires all 3 vectors used to be non-zero!");
|
||||
return 0;
|
||||
}
|
||||
|
||||
return MathUtils::getSignedAngleBetweenVectors(vecA, vecB, norm);
|
||||
}
|
||||
Loading…
Add table
Add a link
Reference in a new issue