Super mario 64 wing cap physics

Recommended Posts

Look at this video: https://youtu.be/wXqlsMGQguM?t=56s

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 on other sites
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 on other sites

Thanks for the info. I have almost solved this problem now :)

Create an account

Register a new account

• Forum Statistics

• Total Topics
628765
• Total Posts
2984582

• 13
• 10
• 25
• 12
• 9