x


Equivalent to Character Controller for Quadrupeds

Hi all,

The player character in our game is a wolf and he has to navigate a Unity terrain with hills, rocks and trees etc. Since we can't rotate the character controller, what is the recommended method for putting a collider on a quadruped?

At the moment we're using the FPSWalker script to move the character around. We'd like to keep the same functionality, so i'm guessing we have to use something like a box collider and write a custom script? This shouldn't be a problem, but i'm thinking there might be issues when going up/down slopes, so maybe something like a capsule collider would work better?

I'd be keen to hear how other people have approached this.

Thanks.

more ▼

asked Apr 30 '10 at 04:20 PM

straydogstrut gravatar image

straydogstrut
1.2k 29 38 60

(comments are locked)
10|3000 characters needed characters left

3 answers: sort voted first

Are you aware of the Locomotion System? As far as I know, it also works with quadrupeds.

Update: the Documentation says:

  • Ground Hugging for Non-Bipeds
    Creatures with more than two legs support their weight differently than humans and other bipeds. The Locomotion System has two simple settings to handle that [...].

and includes a Coyote model for example.

more ▼

answered May 16 '10 at 03:53 PM

Cyclops gravatar image

Cyclops
7.1k 33 63 115

Hi Cyclops, thanks for the suggestion. I knew about the Locomotion System but it completely slipped my mind lately!=S I didn't know if it could be used with quadrupeds though, i'll have a play with it tonight and report back. Cheers.

May 16 '10 at 05:31 PM straydogstrut

Brilliant! I feel really silly now since our tutor at uni was running around with a coyote but I thought it was a tech demo he'd found online, I didn't realise it was part of the Locomotion System. Sheepishly slinking away now, silly me.

May 16 '10 at 06:03 PM straydogstrut

Slinking away without upvoting? tsk, tsk... :)

May 16 '10 at 06:14 PM Cyclops

Whoops! Consider yourself upvoted;-) I'll complete the question once I implement the Locomotion System tonight. Thanks again.

May 16 '10 at 06:16 PM straydogstrut

Heh. Likewise thanks, and good luck locomoting...

May 16 '10 at 06:24 PM Cyclops
(comments are locked)
10|3000 characters needed characters left

i haven't used the character controller yet but my first thought would be to try two sphere colliders, one set to cover the hind legs/body and one for the front legs/body. drive the wolf by moving the forward collider and then let the rear one just follow along, possibly attached by a very stiff spring. that should keep the rear legs from falling through terrain and orient them properly when going up/down hills. swap ccontrol to the rear legs if you want him to be able to walk backwards.

more ▼

answered Apr 30 '10 at 10:45 PM

jester gravatar image

jester
251 1 5

Thanks jester, that's an interesting solution I hadn't considered. I messed around with box colliders and capsule colliders yesterday (adding a rigidbody to quickly get collision going, with comical results!), but I still had the problem of aligning the wolf to the terrain properly. I'll attempt your method when I get a chance and report back. Thanks.

May 01 '10 at 10:44 AM straydogstrut

Make sure to work out the CC collider center, so you can move the collider up or along the X and Z axes. This helped me a lot. Check out my answer regarding what I did to solve the collider...although is not the perfect solution, it might help you.

May 27 '10 at 12:15 AM Arbbot
(comments are locked)
10|3000 characters needed characters left

Hi all,

Great information, but the Locomotion System actually used the default Character Controller with the default capsule collider. If you download the project and add a cube in the scene, you will notice that you can stick the Coyote's head into the cube.

After digging all around the Internet, including Unity official forums and answers, and even Thesis studies of Computer Animation Graphics using Unity, it seems that there's no way around the Character Controller default Capsule Collider. Either you don't use it at all, and use a primitive collider and create your own scripts, or use the default Character Controller.

Now the trick that kind of works, is to modify the default capsule collider to be very high and have the radius cover your model mesh. You need to make sure the capsule's height is high, otherwise characters will be able to walk over the CC capsule. This way you get better side collisions, sacrificing top collisions precision.

Let's hope that in Unity 3 we can modify the capsule to make different shapes, to match not only humanoid forms, but also animals and crazy shaped creatures.

Cheers!

more ▼

answered May 26 '10 at 07:55 PM

Arbbot gravatar image

Arbbot
90 5 5 11

(comments are locked)
10|3000 characters needed characters left
Your answer
toggle preview:

Up to 2 attachments (including images) can be used with a maximum of 524.3 kB each and 1.0 MB total.

Follow this question

By Email:

Once you sign in you will be able to subscribe for any updates here

By RSS:

Answers

Answers and Comments

Topics:

x1682
x667
x5

asked: Apr 30 '10 at 04:20 PM

Seen: 2458 times

Last Updated: Apr 30 '10 at 04:20 PM