0
\$\begingroup\$

I have a car with the following aspect:

https://i.gyazo.com/ac3e7a86d72149f14a7fa7151ae19b88.jpg

As you can see, colliders are locally static, because they are separated from the original rigidbody component.

Well, as you can suppose, I have a problem, because MonoBehaviours with an OnTrigger(...) or an OnCollision(...) method won't work. (It needs an rigidbody and a collider on the same object)

I thought about Raycasting:

https://docs.unity3d.com/ScriptReference/Physics.BoxCast.html

https://docs.unity3d.com/ScriptReference/Physics.CapsuleCast.html

https://docs.unity3d.com/ScriptReference/Physics.SphereCast.html

But I have another problem, I have to specify a direction, so, using this: http://answers.unity.com/answers/539155/view.html isn't an option because this is too slow?

What can you suggest me?

\$\endgroup\$
  • 2
    \$\begingroup\$ It looks like your colliders are nested in child objects under your Rigidbody, so that means they'll be associated with it as dynamic colliders. OnCollisionEnter and OnTriggerEnter do not require the Collider and Rigidbody to be on the same object. The Rigidbody's object will get collisions/trigger messages for events happening on any of its child colliders. Have you found they're not behaving as expected? \$\endgroup\$ – DMGregory Jul 30 '18 at 11:44
  • \$\begingroup\$ @DMGregory I think that what he did was that he might have only tested OnCollisionEnter and not OnTriggerEnter. I found that OnTriggerEnter works without RigidBody, but OnCollisionEnter requires the RigidBody even though I'm not sure, but maybe he just didn't test and expects it not to work. I also agree with what you said. \$\endgroup\$ – Joza100 Jul 30 '18 at 13:36

Your Answer

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

Browse other questions tagged or ask your own question.