Sign in to follow this  

Super mario 64 wing cap physics

Recommended Posts

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

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

Sign in to follow this