Jump to content

Need some math help


Xilandro

Recommended Posts

I need to find the offset in degrees between two Z-angles. Ref01 Z-angle and Ref02 Z-angle, so i will be able to change Ref02 Z-angle and animate it, if Ref01 Z-angle is more than 45 or -45 degrees relative to Ref02 Z-angle o_O I've tried to find out, but failed =\

 

 

just exaple what i want to achieve:

if difference == -45
Ref02.TurnLeftAnimation
endif

if difference == 45
Ref02.TurnRIghtAnimation
endif
Link to comment
Share on other sites


The Z angle in the game is a bearing, not a trig angle. It's 0 - 360 going clockwise, but that shouldn't matter in this case.




float fRef01AngleZ
float fRef02AngleZ
float fAngleDifference


set fRef01AngleZ to Ref01.GetAngle Z
set fRef02AngleZ to Ref02.GetAngle Z


set fAngleDifference to fRef01AngleZ - fRef02AngleZ


if (fAngleDifference > 45)
;do stuff
elseif (fAngleDifference < -45)
;do stuff
endif

Link to comment
Share on other sites

  • Recently Browsing   0 members

    • No registered users viewing this page.
×
×
  • Create New...