CharacterController versus RigidBody.... wow?

I was just playing around and became fixated on the idea of how many objects I could move around (by any means) and keep a decent frame rate.

My prefabs are just capsule meshes with either CharacterControllers or RigidBodies.

  1. Instantiate 200 prefabs with CharacterControllers and call SimpleMove(Vector3.forward * 10.0) each update.

==> 20 FPS on my iMac.

  1. Instantiate 200 prefabs with RigidBodies and call AddRelativeForce(Vector3.forward * 10.0) each FixedUpdate.

==> 100 FPS (max for editor).

I can only imagine Aegis is offloading a lot, but still this surprised me.

Given a typical RTS goal of moving around possibly 100s of units, it would appear CharacterControllers are out of the question?

Charles

The character controller is also using the physics system, but it has to get extra information about what it’s colliding with (slope limit, step offset etc.), which is why it’s slower. It’s intended for moving around first person shooter-type controllers. Definitely you wouldn’t use that for a RTS game; in fact you probably wouldn’t use physics at all for a RTS, except for special effects, like how Age of Empires III uses Ageia physics for certain things (on the Mac anyway; it uses Havok on Windows).

–Eric

I’m sorry, Eric, I don’t entirely follow you;

First off: Mmmmm, AOE3. Top 10 with Aztec 3 times. :smile:

But when you eschew using the CC, yet also say you would not use physics, I’m not sure what options are left. Assuming your units are moving on terrain, you will need either a Rigidbody or a CC, yes?

-Charles

[/quote][quote]

[/quote]

You can use SampleHeight to get the vertical position of the terrain at any given spot, so you can just use transform.position. (Also GetInterpolatedNormal, so you could make vehicles follow the slope of the terrain, for example.) I’m not sure if that’s faster than physics (although I suspect it is), but with a bumpy terrain, you’d have a very hard time moving units precisely where you want to just by adding forces.

–Eric