- Home /
why camera does not recognize the collision?
Hi all, I have an image with 4 colliders wrapping it and a camera (with script, istrigger = true) in the center, when I move the image there at some point it hit the camera with colliders and want to do an action but does not recognize the collision and do not understand.
the script:
void OnCollisionEnter(Collision _object){
print ("there is collision");
}
thanks for your assistance
Answer by prototype7 · Apr 10, 2013 at 01:01 AM
OnCollision events are generated when a rigidbody hits another rigidbody with collider, You can use OnTriggerEnter because to check isTrigger is true and add rigidbody to the image and your camera but set isKinematic checked, this will recognize the collider when isTrigger is true, but will turn off general rigidbody function.
I believe something is bad, not work this way
my camera has, box collider, script(collision with camera), isTrigger = true, and rigidBody (Is$$anonymous$$inematic = true)
the colliders has box collider and RigidBody
what is the problem...
void OnTriggerEnter(Collider _object){
print (_object.name+" -------> test");
}
i test with this and it's working very good... thanksss
A little correction to this:
OnCollision events are generated when a rigidbody hits another rigidbody with collider
It should read
OnCollision events are generated when a collider hits another collider and at least one of them has a rigidbody.
After spending longer time on searching. Found your answer helps me a lot. :)