Splitting this into a x and y point?
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 x̂ + Jy ŷ)
So how can I turn that equation into a x and y?
s (Jx x̂ + Jy ŷ)
is the equation to get a new point. Jx and Jy are the values from the joystick (x-value and y-value), s your speed (the higher, the faster) and x̂, ŷ are the x- and y-vectors from your coordinate system set by the camera (you have to compute those every time you compute a new movement)
So take these values, use the formula and you'll get a new player coordinate in the normal x/y plane. (iaw, the result is a point with an x and a y component, which are you x and y values)
精彩评论