Platformer physics questions...

I want to make a 2D super mario bros. clone and I have some questions about it.

1:
If I am using a script like this for running, is there a way to set a terminal velocity for the object? Yes, I know this is dealing with the force that is pushing the object, but how can I make sure that force is added only up to a certain point(so that there is a limit on how fast the character can move, regardless of how long they have been running)?

rigidbody.AddRelativeForce (Vector3.forward * thrustSpeed);

2:
To continue that question, how can I just keep adding force and then suddenly cut it off? I am taking about the jumps. The longer the player holds the button (.2 seconds vs. .5) the higher the jump, but at a certain height it just cuts off, no matter if the button is being held or not, how can I do that?

3:
If I am incorporating physics into this, can I still cheat certain aspects of physics (giving the player air control, so that they can jump forward, held the back movement button and not move forward)?

Thanks :slight_smile:

If you’re going for a pure super mario bros gameplay : don’t use physic. Just handle movement equations by yourself : so much more easy to tweak !

But then how can I get the feel of accelerating when you hold down a button and then having inertia so the character doesnt just stop immediately? And what about the variable jump height? If I use transform.translate functions for movement it feels very rigid and fake(I mean, not that Mario had havok physics or anything, but it had a feel of inertia).

Use Lerp or slerp or implement some simple physics yourself in Update().

Mario physic is highschool Math equations.
position = position + speed * time
speed = speed + acceleration * time
etc…
If you are not familiar with these, I would highly recommend a perfect book for you : “Foundation Actionscript 3.0 Animation: Making Things Move!” by Keith Peters. Obviously this is for actionscript learning but hey, 2D games physic is the same wether you’re in Flash or Unity. There may be other resources for C# or Javascript, but this book does a good job of taking you from 0 to a fairly good level in understanding what is 2D physic.