0
$\begingroup$

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$?

1 Answers 1

1

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.

  • 0
    Wait, how is xˆa vector? It's just "x / |x|" which is x divided by absolute x.2010-12-06
  • 0
    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.2010-12-06