[SOLVED] Bowling Game, Bowling Pins Rigidbody Problems

image_2023-12-28_195336975

When the pins are knocked down I disable them and respawn all the pins, however when they respawn the pins that had fell over would tip over after they respawn (Keep in mind this does not effect pins that suffered a collision but did not fall).
Please note I have tried setting linear and angular velocity to zero and have also tried changing rigidbody type.

Hi @gameBole!

What do you mean with ‘tip over’?

What kind of collision do you use (shape and type)?

Can you share the code for respawn?

image

As you can see the pins have tiped over when respawning however if I were to miss the pins would respawn in their normal positions.

I am using dynamic type and cylinder shape

Here is the respawning code:

for(let i = 0; i < this.pins.length; i++) {
            let pin = this.pins[i];
            pin.entity.enabled = true;
            pin.entity.rigidbody.linearVelocity = pc.Vec3.ZERO;
            pin.entity.rigidbody.angularVelocity = pc.Vec3.ZERO;
            pin.entity.rigidbody.teleport(pin.pos, pc.Vec3.ZERO);                        
        }

I don’t see anything wrong, but it looks like teleporting is not working as expected.

Are you be able to share the editor link of your project, so I can take a look?

I have fixed it, you see the problem was that the pins collider and the floor collider were conflicting meaning that some of the bottom part of the pin’s collider was inside of the floor’s collider now I just adjusted the y-axis on the respawn position of pins and everything is fine.

1 Like