Hi guys, I installed Cocos Creator 3.8.4 yesterday and encountered a very confusing problem. I have a little experience with Unity but I’m new to Cocos.
I created an empty 3D project and tried to make a shooter game.
Bullets are created on a shoot point, traveling to the front of the shoot point.
The bullets have a cylinder collider and a rigibody attached to each, where useGravity is off and the type is dynamic. isTrigger for the collider is also off.
The enemy unit has capsule collider but not a rigidbody.
While testing on a browser, I can visually see the bullets bounced sideways by the enemy. However, the onCollisionEnter(other: Collider, self: Collider) method in the Bullet.ts script attached to the bullet prefab is never called.
if it’s a bullet type, with high speed, you could try enabling continuous collision detection
/creator/3.8/manual/en/physics/physics-ccd.html
I am fairly new to cocos and haven’t worked with physics yet. I only know of unity. But I hope someone will help you out.
Thanks. I think it’s not about being continuous or not as I tried it before posting.
Also in the second test, I created a brand new project with nothing but the two items to collide and a script with onCollisionEnter only, and it didn’t work either.
did you make sure the script is attached as a component? edit: Oh I see, it might be a good idea to check out Cyan’s video tutorial on youtube to get a refresher on how to do it.