• 13
• 18
• 19
• 27
• 10

# Creating 3D Character Movement?

## Recommended Posts

I'm starting to learn Unity and how to create movement in a 3D space within it.

I want to create a tight-controlling 3D platformer, with Super Mario 64 being a main example. The weight, physics and constraints of the movement in it are something that I would like to recreate and learn more about.

I've opted to use the CharacterController in Unity rather than a RigidBody, as I feel I would learn more by explicitly developing the movement system by code. I would like to know, what are some good resources/techniques to learn when developing a 3D movement system? As of now I have a jump system which works quite fluently, but as for anything on the X and Z axis, I'm at a loss. I feel like there's so much that goes into controlling the character's momentum and velocity, and expressing that through code is something I'm finding difficult.

I understand that the Unity forums may be a good place to ask about this, but I felt as though this issue is not exclusively related to Unity. I would like to know these techniques in general, not just for Unity.

Thanks, all help appreciated!

##### Share on other sites

I worked on a 3D platformer as my college capstone, with SM64 as my primary inspiration, so I have some perspective on that style specifically.

As for movement, check out the Mario 64 section in Game Programming Gems 2. Most notably, this exponential dampening formula is incredibly useful for that sense of weight and inertia you're looking for. This is how it would be used for turning (from the book):

new_ratio = 0.9 / FPS

old_ratio = 1.0 - new_ratio

new_dir = (old_dir * old_ratio) + (desired_dir * new_ratio)

Normalize( new_dir )


Note that FPS would be 60 in 60fps etc, so in Unity you'll have to multiply by deltaTime.

After learning that formula from the book I began applying it to everything, not just turning, and I found the results were great.

If you have any other questions about 3D platformers / Mario 64 mechanics feel free to inbox me if you want to have a longer discussion, I did spend over an entire semester thinking about it and practicing it.

Edited by cmac