- Home /
How to create imaginary perpendicular lines for use in camera targeting in an 3d environment?
I am writing a script for a camera behavior that is called when the player press a button. I think this behavior is usually called "Camera Lock" or "Camera Targeting". The final result expected is something similar to the 3d Legend Of Zelda Games.
What I am having trouble with is that, when the player press the button for the Camera Lock, I would like to create an imaginary line from behind the character to the target (let's name it line A), and a line perpendicular to that one (line B). When the player moves in the line B, he pushes it, also moving line A so the two lines keep perpendicular. I also would like to know if the player is in the left side or right side of line A, and also the distance from the player to both lines.
I can understand both C# and JavaScript, but since I am using JavaScript in my game, an answer with JavaScript would be appreciated.
Thank you for your time.