Detect falling over in bowling

I’m trying to create a bowling game. I created a pin from a capsule on a cylinder. I parented them and then attached a rigid body to the capsule. My thought was when the pin falls over and collides with the floor then I could detect that it has fallen over. The script does not seem to work however.

Is there a way to see if an object has fallen over?

Try finding the Vector3.Dot between the pin's transform.up and Vector3.up! If the dot product is 0, then your pins are standing up, and if it is 1, then your pins have fallen over. No need for collision detection at all! You could even define some threshold point (between 0 and 1) which determines at what point the pins are declared 'fallen'.

You can do a Physics.RayCast coming out the top of the pin.

Then have 4 colliders surrounding where the pins are kept. If your raycast from your pin head intersects any of these 4 colliders, then you know the pin is horizontal.

I tried if(transform.up.z<0.5f) but that did not work, but changing it to if(transform.up.y<0.5f) worked beautifully.

I want to try the Raycast option too, but just because I need to practise that.

Thanks for all your help

I tried if(transform.up.z<0.5f) and that did not work, however if(transform.up.y<0.5f) worked beautifully.

Thanks for all your help.

Steve