[SOLVED] Collision Destroy Problem

Hello! I am new in coding and in PlayCanvas. My code for collision isn’t working properly. I am not entirely sure what is wrong. Both entities have RigidBody (Dynamic) and Collision component.

Here is the Collision code:

image

Screenshots:

Instead of getting destroyed when hit by the witch, the cat was being pushed (because it’s Dynamic), but I want it to be destroyed. I set the RigidBody for the witch so I can applyForce for its movement.
What am I doing wrong? Thank you so much!

Link for the editor: PlayCanvas | HTML5 Game Engine

Hi @coffee and welcome! It took me some time to catch it, but the problem here is that you’re missing a capital letter. As a result, the onCollisionStart function is never executed.

image

1 Like

Oh! Wow! I’ve been stuck for hours, and it is just one letter! Maybe, I’ve been looking at it for hours that I don’t know things anymore. Thank you so much!

Can I also add another question? What does this mean?

That error is because you try to play a sound while there is no sound component on the entity.

It’s okay now! Thank you!

2 Likes