1
\$\begingroup\$

I know this question has been asked several times but none of the answers solved my problem.

I made an sphere and gave it rigidbody. then I draged the sphere on to a new made prefab.

on mouse-click Instances of this prefab are made and shot. the spheres collide with things in the scene but the onCollisionEnter function is not called. all things in the scene have colliders.

I would be grateful if you could tell me what's wrong

edited: it works if either the sphere or the other object's collider is trigger and I use onTriggerEnter.

\$\endgroup\$
2
  • 1
    \$\begingroup\$ Is this kinematic rigidbody? \$\endgroup\$
    – SanSolo
    Jun 20, 2015 at 16:39
  • \$\begingroup\$ Set collision detection to continuous and check \$\endgroup\$
    – SanSolo
    Oct 20, 2015 at 3:43

3 Answers 3

1
\$\begingroup\$

Since you mention onCollisionEnter, could it be a typo? because, the function is written OnCollisionEnter (upper case O)

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

I believe this happens because the bullet's speed is very fast so the collision doesn't have enough time to be detected, that's why I prefer using raycast for the shooting.

\$\endgroup\$
0
\$\begingroup\$

For me it worked when I made the first letter O of OnCollisionEnter capital. Hope that helps someone.

\$\endgroup\$

You must log in to answer this question.

Not the answer you're looking for? Browse other questions tagged .