Script Canvas - basic collisions and triggers not working

Using Lumberyard 1.17 I have been following the tutorial

and I have been encountering issues with triggers and collision detection not working. I’ve tried several different routes to get this working but all fail at the same point.

I have two entities - Ball and Wall



The Wall has a Script called collisiontest which looks like this.

But I am not getting anything in the console from the debug print when the ball moves into the wall space. Neither a OnCollision nor a OnAreaEntered/OnAreaExited

On the controls for my Ball, I have a debug Print action that logs the movement which is working fine, so I know the print works

I must be doing something wrong in my set up but I cannot spot it. I’ve been through the tutorial a few times and keep trying to simplify the process to work out what the issue is.

On a side note, if I drop in the player.slice from the starter game project. My script detects when Jack enters the “wall”.

Hi @LS

Thanks for the quick response

I’ve tried both static physics and rigid body physics on both the wall and the ball, in all combinations, and it still doesn’t seem to have an effect on my collisions or triggers

I’ve also noticed, that if I load the starter game sample and add an entity with rigid body physics and the mass/density setting to Mass, the entity falls to the ground. It doesn’t do this in my example, instead it just floats.


It’s like the “Physics” is turned off

Hi @goatfather

Your Ball entity needs a Rigid Body Physics component. It currently has a Static Phyisics which the physics system uses for non-moving objects.

I’ve created a clean new Project, with the default Gems enabled, and a new level.

I’ve followed the instructions on the tutorial - Components_Basics(04)-Physics-Collider-Component_1.8.pdf

I create the sphere using a Mesh, add the Mesh Collider, the Rigid Body Physics as per the instructions of Step 1 in the doc above.

I run the game or click on the AI/Physics option, the sphere floats and doesn’t fall to the ground like it is supposed too.

What am I doing wrong?

I believe the MtlSphere object is meant for testing materials and does not have a physics mesh, this means the Mesh Collider component has no effect. Try changing the mesh in the Mesh Component it to Engine/Objects/primitive_sphere

YES! Hoorah, thank you. That is it. The ball now collides with objects and trigger areas