Jump to content
  • Advertisement

Archived

This topic is now archived and is closed to further replies.

Samith

wtf!?!? stupid thing

This topic is 6071 days old which is more than the 365 day threshold we allow for new replies. Please post a new topic.

If you intended to correct an error in the post then please contact us.

Recommended Posts

ok, im making a small 3d engine thing, right now you just kinda fly around. i got the rotations to work out right, but lets say you rotate to the left 90 degrees, then hit the up button, you excpect to go forward right? well, you go to the right, is there a way i can fix this? thanks if you need more detail or need to see my code just tell me

Share this post


Link to post
Share on other sites
Advertisement
Guest Anonymous Poster
This has nothing to do with rotations nor with the gimbal lock, that''s something totally different.

All you need to do is update your camera translation depending on your flight direction.

- AH

Share this post


Link to post
Share on other sites
Wow, these forums are short on help aren''t they?

I think, Samith, that you need to (as mr. Anonymous Poster stated) change the translation you do when going ''forward''.

Picture this: If you''re facing North and you walk forward, you''ll move North. But if you''re facing West and you walk forward, which way do you think you''ll move?

Your program says North.

How to make it say West?

Your rotation should be calculated from the positive x direction, with the left-rotation as positive to work.

So use this: (steplength is how far you''ll move)
translation for x = cos(rotation) * steplength
translation for z = sin(rotation) * steplength

Make sure you convert to radians first (rotation * 3.141592653589793238462643383279502884197169399375105820974944 / 180) so the sines and cosines work right.

Share this post


Link to post
Share on other sites
Guest Anonymous Poster
quote:

Make sure you convert to radians first (rotation * 3.141592653589793238462643383279502884197169399375105820974944 / 180) so the sines and cosines work right.



LOL This is sick, you have a PI-mania...

- AH

Share this post


Link to post
Share on other sites

  • Advertisement
×

Important Information

By using GameDev.net, you agree to our community Guidelines, Terms of Use, and Privacy Policy.

Participate in the game development conversation and more when you create an account on GameDev.net!

Sign me up!