Rotation relative to another entity

Blitz3D Forums/Blitz3D Beginners Area/Rotation relative to another entity

Shredster7(Posted 2012) [#1]
Hello there,
I'm trying to create some A.I. for a racing game in Blitz3D. The AI is currently split into two parts: the "driver", or "brain", which automatically points towards the next checkpoint, and the "car" or "body" which slowly turns so it's facing the same direction as the driver\brain.
I'm running into an issue where, if the cart's yaw value is 170, and the driver's yaw value is -170, the cart will attempt to reduce it's yaw value from 170 to -170 by going in a circle. (This is because it doesn't know that it can jump from 180 to -180.)
What I would like to know is if there is a way to calculate an entity's rotation RELATIVE to another entity? (I.E. so that the car always thinks that the driver's rotation is zero) I'm assuming that one of the TForm commands is able to do this; however, I'm having a very hard time understanding them.

Thank you for your time!

Last edited 2012


GfK(Posted 2012) [#2]
Very simple - use DeltaYaw() instead.


Matty(Posted 2012) [#3]
Or don't use angle rotation commands, use aligntovector instead...