To use or not to use (Physics)

Hello, I have been working with Unity 2D projects for a couple of years and now I want to dive on 3D. I am trying to study and create a character controller, camera controller etc. Firstly I would like to emulate Kingdom Hearts 1 movement and attack, but I have so many doubts about using or not physics to move my character. What would you recommend? In this specific case but also on some others…

3D platformer? Definitely want to use physics. 2D math is fun and all, but 3D math to replace a physics engine for a platformer? I’d save myself the hassle. :stuck_out_tongue: Man, sliding collision alone made my head hurt back in the day. :smile:

This depends on what you mean with “Physics”. I think there’s a pretty fat line between intersection testing, depenetration and full blown physics.

Rigidbodies are designed to act realistically with forces where as a character is VERY rarely a physics enabled entity.

This is why PhysX has a CharacterController module, altough the Unity implementation stripped a lot of useful functionality.

SAT is a good and pretty simple algorithm for interaection tests in 2D and 3D, it also provides the means for a very easy but effective resolution step as it returns the minimal translation distance needed to separate 2 intersecting entities.

Luckily, this is what Physics.ComputePenetration() does and it makes for a great kinematic character controller base, but you’re also going to need to know a bit about the environment.

What is the player standing on? What’s the ground angle? This is a little bit more tricky, but depending on your use case, a simple ray or spherecast may be enough.

@PhilSA recently made a very good kinematic character controller that more than likely fits your needs, it’s on the asset store, named “Kinematic Character Controller”.

If you want to make your own controller, then read up on Iron-Warrior’s SuperCharacterController blog, it’s a good read for sure.