- Home /
Determine new position from magnitude & rotation/heading
Hi! Looking for a general approach to this: I have the device's compass attached to my player's camera and, at specific times, want to move the player some distance, say 1 unit, in the direction the camera is pointing. I'm not sure how to determine the position the player should be moving to - getting hung up on the relationship between the player's position and rotation is my guess. Many Thanks!
Comment
Answer by hexagonius · Nov 17, 2016 at 09:33 AM
the camera's transform forward is the world space direction it points into. character transform position plus that is 1 unit away from the character in camera view direction. If you now program the character to be able to move towards any position, you can just pass the result in and bam.