I am making an XR game, and I am stuck with a part. Does anyone know a function that would detect this?
OnCollisionEnter
and OnTriggerEnter
don't appear to work with a CharacterController. Can anyone help?
\$\begingroup\$
\$\endgroup\$
Add a comment
|
\$\begingroup\$
\$\endgroup\$
2
OnCollisionEnter
and OnTriggerEnter
require both objects to have colliders and at least one of the objects to have a Rigidbody. You might also try OnControllerColliderHit
, which is documented here.
-
\$\begingroup\$ Is there any other way of testing for a collision with a character controller? \$\endgroup\$ – OskarZyg Jul 13 '20 at 18:39
-
\$\begingroup\$ You can look at
OnControllerColliderHit()
: docs.unity3d.com/ScriptReference/… You haven't provided any information about what you've already tried or how your objects are set up, so it's difficult to give more specific answers. \$\endgroup\$ – Kevin Jul 13 '20 at 18:46