- Home /
Have something be a trigger and a collider?
Hello. I am making a bowling game. I was going to have the score increase every time a "pin" object collides with the "floor" object, but how can I do that? If I make it a trigger the pins/floor will be immune to physics and the game wont work, any ideas? Thanks
Comment
Answer by matyicsapo · Nov 26, 2010 at 09:46 AM
Don't make it a trigger just check the relative velocity in the collision events. Starting out the pins should be resting so the score will only increase when they collide with some minimal velocity. The bumping pin might register a hit with a velocity high enough to increase your score again so you should only count a pin once per game but I'll let you figure out that on your own.
C# code:
void OnCollisionEnter(Collision collision) {
if (collision.relativeVelocity.magnitude > X) // Xperiment with some values
// to fit your particular
// situation ;)
score++;
}
Your answer
![](https://koobas.hobune.stream/wayback/20220613084611im_/https://answers.unity.com/themes/thub/images/avi.jpg)