i have a entity in my game that needs to point at a another entity (like PointEntity()) except the mesh only needs to move it's yaw angle. also, i need it to work like in metal gear solid - you know, the enemy soldiers turn left or right if they aren't pointing directly at solid snake.
does anyone have a function that will tackle this problem that i'm having or am i not being clear enough. any help is appreciated
I think the function you might need to use is ATAN2(x,y). I haven't got the time at the moment to put some code together but basically use TFORMPOINT to determine the destination entity's x and z position relative to the source entity. Then use ATAN2(x,z) to determine the EntityYaw() of the source entity.
I hope that's not too vague.
Regards
Johnno
I think that's basically what DeltaYaw does internally.
why not just save the entity's pitch + roll, use pointentity and then set it's pitch and roll back to the saved values?
like:
pitch# = EntityPitch(e)
roll# = EntityRoll(e)
PointEntity e, e2
rotateentity e, pitch, entityYaw(e), roll
Can anyone think of a reason this might not work?
Just looked up DeltaYaw in the manual - I didn't know that such a function existed!
Wish I'd known about it before - About 2 years ago I spent ages working out a way (using the Atan math stuff) to get objects to slowly turn to follow each other (like homing missiles)