# Super mario 64 wing cap physics

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

## 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 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

Sorry for the late reply.

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

1. 1
Rutin
30
2. 2
3. 3
4. 4
5. 5

• 13
• 13
• 11
• 10
• 14
• ### Forum Statistics

• Total Topics
632961
• Total Posts
3009494
• ### Who's Online (See full list)

There are no registered users currently online

×