Jump to content
  • Advertisement
Sign in to follow this  
karl88

Super mario 64 wing cap physics

This topic is 581 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

Look at this video: 

I want to code this super mario wing cap motion in my game engine. What kind of formulas do I need to code this motion in 3D?

Edited by karl88

Share this post


Link to post
Share on other sites
Advertisement
https://en.wikipedia.org/wiki/Equations_of_motion

Those may look intimidating but at their core they are pretty simple. Given a position and a velocity on object you can calculate where it will be at any given time.


position = position + velocity * time
Just like mario, things don't usually travel in a straight line. When you apply a force to something it accelerates. Acceleration effects the velocity over time
velocity = velocity + acceleration * time
So now the trick is figuring out the forces that cause acceleration. There is a constant acceleration pulling down on the player, which is gravity. Flight overcomes gravity. A naive implementation would just project gravity vector onto the players forward vector resulting in the final acceleration.
Vector Projection
acceleration = project(gravityVector, forwardVector);
Putting it all together you get
 
position = position + velocity * time
acceleration = project(gravityVector, forwardVector);
velocity = velocity + acceleration * time
You would still have to figure out how to handle stalls, drag, and probably a few other details to mimic mario's flight, but hopefully that gets you going in the right direction. Edited by HappyCoder

Share this post


Link to post
Share on other sites
Sign in to follow this  

  • 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!