Colliders on the Humanoid’s feet

Would it be nice to be able to kick against some Rigidbodies in a scene like a ball? Although Humanoid control provides full physics on the hands, colliders on the feet take a bit more effort. But this article will show you it is not very hard.

Using tracking devices like the Vive Tracker it is possible to move around the avatar’s feet with your own foot movements. It you want to be able to kick against objects you need to attach a collider to the feet or leg bones. This should be done on the avatar itself, to ensure that the colliders are always matching the visible pose of the avatar.

For this article I will use Avatar_MakeHuman_medium_TP found in Characters/MakeHuman_simpleRig of the Humanoid Control package.

I will attach the colliders to the feet bones: Default_simple|Foot_L/R.

As the feet bones are not aligned with the ground, but rotated forward.

So I will add an additional child GameObject FootCollider which is aligned with the ground.

To this GameObject we will add a BoxCollider component and a Rigidbody. Make sure the Rigidbody is set to Is Kinematic, because we will be moving the foot around using tracking, not physics.

Now we have the collider attached to the foot.

But if you would press Play now in the Unity editor you will see that the foot will be moving everywhere. This is because the foot tries to stand on its own colliders (which is clearly not possible).

To prevent this from happening you need to set the Layer of the FootCollider to Ignore Raycast. In this way, the ray cast from the foot will no longer see the Foot Collider and the foot will behave normally again.

Do the same with the other foot and you will be able to kick the ball!

Leave a Reply