1
\$\begingroup\$

I have 3D wolf models from my animator with displacement (i.e the wolf transforms with animation, not in-place). I have added rigid bodies to the models. I am facing following issues while executing them in my project:

  1. When I turn on IsKinematic on my rigid body (i.e disable physics) the animations work perfectly, with displacement. But I need to have physics enabled on my wolf because it doesn't detect collision when physics is disabled and gravity doesn't have any impact.

  2. When turn off IsKinematic (i.e enable physics), the animations don't work; the wolf start wobbling and flying in the air.

How can I resolve this?

\$\endgroup\$
1
\$\begingroup\$

It depends on what type of collisions you want to resolve and who controls the wolf.

Wolf is NPC

If you want to resolve collisions with static environment you should think about using NavMeshAgent and bake static geometry to navigation mesh (so, that kind of collisions will never happened). If you want to collide wolf with other units with simple colliders (for example capsule) you can implement custom collision behaviour by using methods: OnTriggerEnter, OnTriggerExit and OnTriggerStay. In this case set isKinematic on true in wolf's RigidBody component, and isTrigger on true in wolf's Collider component.

Wolf controlled by player

In that case, you can use RayCast to check can you move wolf in preferred direction or not before move it. You even don't need RigidBody component be attached to your wolf.

\$\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.