[SOLVED] Colliding with Coins and Character

Hello, I have a problem with Collision regarding my character and coins (two entities). My character cannot collide with it. I tried using these codes and proper settings but it would not work

Here is the link to my game: PlayCanvas | HTML5 Game Engine
PlayCanvas | HTML5 Game Engine





Hi @ETHAN_FOX_CRISTOBAL!

I think the statement on line 15 of your script should be like below.

if (result.other.name == 'Coins') {

}

I think you need to make player rigidbody “Dynamic” and coins doesn’t need a rigidbody function it only needs a collision

This can be an option, but this depends on how you script the movement.

This can be an option, but this depends on how you script the collision.

Thanks for the tips, but unfortunately it still did not work but I will treat this as a learning experience.

I made a mistake in my code above, because result.other is already the entity. The code should be like below. (I also update my answer above).

if (result.other.name == 'Coins') {

}

Apart from that, your current setup is not correct. The player has a static rigidbody and the coin is missing a rigidbody. If you change it back to what you shared here, it should work as expected.

1 Like

The script is given to be my teacher but it still doesn’t work whether the assets are my problem or the coding. I tried to follow the steps but it is not working.

Not sure what you mean with this.

I checked it myself and it works.

https://playcanvas.com/project/972189/overview/balldozersfork

Albertos, thank you man. How did you fix it?

First I changed everything back to what you shared on the screenshots of your first post and after that I made the script change.






PlayCanvas 3D HTML5 Game Engine (this is the link)

this is really a problem actually.

On your screenshot the script is not saved yet.

it works thank you man.

1 Like

Work carefully to make sure that everything goes well

What’s ironic, my collision works on this scene but not on this scene.

Lucky for you that you now have a working example. :upside_down_face:

Albertos, I need help. I sent my concern. Can u reply to it
This is Ethan