Take the 2-minute tour ×
Mathematics Stack Exchange is a question and answer site for people studying math at any level and professionals in related fields. It's 100% free, no registration required.

Alright, so I'm still trying to make my players movements relative to the camera. I got a good answer here But he ends it with: $s(Jx \widehat{\mathbf{x}} + Jy \widehat{\mathbf{y}}$)

So how can I turn that equation into an $x$ and $y$?

share|improve this question
add comment

1 Answer

up vote 1 down vote accepted

If you read the answer you reference, $\widehat{\mathbf{x}}$ is a unit vector perpendicular to the vector from the camera to the player and $\widehat{\mathbf{y}}$ is a unit vector pointing towards the player from the camera. Each has x and y coordinates in your coordinate plane. $Jx$ is the x coordinate of the joystick position with a range depending on how you read it out. Maybe it goes from 0 to 10 degrees. Similarly for $Jy$. So you form a new vector by multiplying and adding, then scale it by a constant $s$ that represents how fast the player should move for a given motion of the joystick. This gives you a vector that you add to the current player position to get the new player position.

share|improve this answer
    
Wait, how is xˆa vector? It's just "x / |x|" which is x divided by absolute x. –  CyanPrime Dec 6 '10 at 6:20
    
But the numerator is boldface, which indicates a vector. You have two natural coordinate systems, one with y along the axis from the camera to the player, and one the system you do all your calculations in. He is showing you how to transform between them. –  Ross Millikan Dec 6 '10 at 13:47
add comment

Your Answer

 
discard

By posting your answer, you agree to the privacy policy and terms of service.

Not the answer you're looking for? Browse other questions tagged or ask your own question.