Jump to content
  • entries
  • comments
  • views

Going back into study mode

Sign in to follow this  


Yesterday I made it so that you could control the pitch, heading, and roll of your ship using the mouse and cursor keys. Pitch and heading adjustment works fine, but roll is dependent on the direction that your ship is facing; I actually suspect that the other two have similar problems as well, just not as pronounced. This led me to start reading through physics articles to try and find a solution.

While reading the articles I was reminded that I still don't know much about mathematical programming (linear, quadratic...), which seems to pop up a lot in physics and makes an appearance in collision detection. I figure this is as good a time as any to correct that, so I have started going through the free classes on the Stanford website located here: http://www.stanford.edu/~boyd/ Class EE263 is a prerequisite for the convex optimization classes, so I'm starting there. If this starts taking too long, I may decide to postpone further study in this area, but hopefully I won't have to.

Writing blog entries will be a bit challenging for a variety of reasons, but the plan is to continue updating at least five times per week. The last thing I want to do is just repeat what's said in the lectures, so I may draw from multiple sources when I discuss what I have learned.

Reposted from http://invisiblegdev.blogspot.com/
Sign in to follow this  


Recommended Comments

The way I perform pitch heading and roll is to store rotation as a 3x3 matrix (or a quaternion). Then when you update any of the pitch/head/roll angles, just create a new rotation matrix (or quat) for each around x,y or z respectively and multiply the current 3x3 rotation matrix by these news ones to update the rotation. This might not be the cheapest way of doing it but it definitely works, avoids gimbal lock etc etc.

Share this comment

Link to comment
Yes. Each rotation you make does not only rotate the model itself, but also the other axes with the model. So the next rotation you make is influenced by the previously made rotations. You need to make the rotations in exact order the player do them. If he rotates 5° by X, then 10° by Y, and then 3° again by X, you can't simply rotate by 8° by X and 10° by Y. You have to make the rotations exactly as they came from player.

You can do that by storing your actual rotation matrix. When player will then want to rotate by 5° by X, rotate the matrix you have stored:

[i]actualRotationMatrix = matrixOfWantedRotation * actualRotationMatrix[/i]

This way each rotation you make is incorporated in the final rotation matrix in the order it was made :wink:

Share this comment

Link to comment

Create an account or sign in to comment

You need to be a member in order to leave a comment

Create an account

Sign up for a new account in our community. It's easy!

Register a new account

Sign in

Already have an account? Sign in here.

Sign In Now
  • Advertisement

Important Information

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

We are the game development community.

Whether you are an indie, hobbyist, AAA developer, or just trying to learn, GameDev.net is the place for you to learn, share, and connect with the games industry. Learn more About Us or sign up!

Sign me up!