Hi all, i would like to detect collision between the worm and my player. So if the player collide with the worm, it will fly away and deduct the BP. I have added rigidbody to my worm. And when i run my games, my worm drop infinitely out of the scene. Can i know why?? I am very sure that it is place properly on the terrain. So aren’t very sure why it will drop infinitely. Please help.
// Make all rigidbodies we touch fly upwards
function OnCollisionStay(collision : Collision)
{
// Check if the collider we hit has a rigidbody
// Then apply the force
if (collision.rigidbody)
{
collision.rigidbody.AddForce (Vector3.up * 15);
}
}
Check if the worm collider is set to trigger - with Is Trigger set, it will fall through the terrain. Another possibility: if the worm has a mesh collider, you must set Convex, or it will fall through the terrain.
– aldonaletto