2
\$\begingroup\$

With a few friends I started to make a 3D game in the style of the old platformers à la Super Mario 64 / Spyro / Banjo Kazooie.

So now we are thinking about the controls and how to do them.

There seem to be two mutually-exclusive options: Giving our character a rigidbody and however many colliders we want OR using a character controller.

  • At the moment we have a rigidbody with a collider which technically works, but we have to make our own grounded check, and movement, while those two in particular are relatively easy to implement.
  • If we start to use a character controller OTOH, we won't have all the collisions anymore and programming logic needs to be applied in a different way.

Let's take a jumppad as example:

  • If we use a Rigidbody, the jumppad itself checks if someone is standing on it, and if so it increases the jumpstrength while that someone stands on it.

  • If we use a CharacterController, we'd have to check not only if we are standing on a jumppad, but also on which one, to determine the actual jumpstrength, as they might differ between pads.

So, is there a clear winner to use in a 3D platformer with fighting elements or do we have to work with limitations on either and just have to work around them?

\$\endgroup\$
1
  • \$\begingroup\$ @ArcaneEngineer As far as I know CCs do not have any physics at all. And because they are not a rigidbody, they do not interact so easily with other objects in the world. And if you have any suggestions to make the post less "should I", I'll be happy to make these edits. \$\endgroup\$
    – Nutty
    May 30 '17 at 11:40
3
\$\begingroup\$

It's not either-or. It's both.

Stick with the CharacterController initially. Go through the initial pain of writing it the way you want it under normal (kinematic) control circumstances, as there are things that Rigidbodys do to player characters that you won't like under various circumstances. It's like RL - we're generally in fine motor control of our bodies until we get hit by a bus or fall off a ledge. Characters likewise are primarily kinematic bodies, and take on rigid body / ragdoll characteristics only in cases involving large forces.

Your CharacterController would be your primary control manager, and as such it would handle default kinematic controls, but turn on / turn over control to a local Rigidbody component only once it becomes appropriate to do so (for example, when the player jumps and falls, or dies in water and floats to the surface). And e.g. once you respawned, you could have the Rigidbody relinquish control.

In circumstances like the jump-pad you mentioned, if you're in a kinematic mode at that point, I would just make the checks explicitly, as you suggested. Whereas if you were already falling i.e. were in physics mode, then of course the thing should take care of itself as you hit the pad.

\$\endgroup\$

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service, privacy policy and cookie policy

Not the answer you're looking for? Browse other questions tagged or ask your own question.