Hello guys, i’m new here and trying to learn the engine by doing a snake game, but i’m having trouble with my collision function.
I’m doing the same thing as this tutorial (https://developer.playcanvas.com/en/tutorials/collision-and-triggers/) but the function isn’t created, and i used a debug log message on initialized function and the script is working, i know this must be something easy to solve, but i tried and searched everything about.
Hi @FernandoIM,
It seems that the Box entity you have doesnt seem to have a rigidbody component which is needed for collisionstart to work, if you dont want to add the rigidbody component you could use the triggerenter event instead
So, i tried with rigid body before, but after u said, i’m trying with collision and rigid body on my player, and only collision on the entity i want to be a trigger.
Collision events are only fired when two rigidbodies collide. In this case where you have a rigidbody and a trigger, only trigger events are fired on the trigger entity.
Thank you for the help, i fixed the event to trigger like you did.
I’ve tried this setups before, but now i think my mistaken was in my rigid body type, i was using static all the time, now i need to learn about each type and how/when to use then.
Oh, FYI, I fixed the camera as it was rendering in a weird way. You had the near and far clip values flipped so the near plane was further away than the far plane