Question about VELOCITY

Posts 1–4 of 4 · Page 1 of 1
Question about VELOCITY
Code:
if (GetAsyncKeyState('A')) 
	MyObject->Velocity.x -= 0.5f;
if (GetAsyncKeyState('D'))
	MyObject->Velocity.x += 0.5f;
if (GetAsyncKeyState('S'))
	MyObject->Velocity.z -= 0.5f;
if (GetAsyncKeyState('W'))
	MyObject->Velocity.z += 0.5f;
Problem: When i turned my mouse into 180 degree the localplayer move opposite direction but its normal when you do not make any move of your mouse/camera
or do i need to calculate also the rotation of camera ?

Someone help me how to solve this ?

TIA
it's based on coordinates. You need to use the yaw to calculate the direction
Quote Originally Posted by UltraPGNoob View Post
it's based on coordinates. You need to use the yaw to calculate the direction
Just complementing, use Pitch(Calculate X and Z) and Yaw(Calculate Y, if needed).
if you're planning on doing freecam indeed you will need pitch aswell for up and down.
Use math.h and cos and sin to calculate the x, y and z depending on 3 different axis such as xz, xy and yz
Btw on CF roll doesn't seem to be calculated unless it changed lately which I don't think so.
Posts 1–4 of 4 · Page 1 of 1

Post a Reply

Similar Threads

Tags for this Thread

None

Need help?