Problem with Player Colliding with Buildings

Good evening.

I am currently getting started with Defold Engine, and I’ve tried to enhance the War Battles Tutorial with more things to collide with.

For example, I managed to make the rockets to collide with a building (although firing it too close to it makes the animation to bug itself), and now I am trying to make the player not being able to walk through the building, but I haven’t been able so far.

The building itself, it’s a GameObject with a Static Collider, and the player has a Kinematic collider.

Here you have the full project in case you want to take a look.

War battles tutorial.zip (2.4 MB)

Many thanks for your help in advance.

Some things to check:

  • Does the building collision object have the player collision group set as its mask?
  • And does the player collision object have the building group added to its list of things to mask with
  • There needs to be a 1:1 relationship
  • Double check the collision object type so that it is indeed kinematic or static for the building
  • Open game.project and scroll to Physics and toggle the Debug checkbox and run your game. Do you see the collision shape for the building? And do you see any kind of interaction (arrows) when the player collides?
  • In on_message on the player script add a print(message_id) and check that you’re getting contact_point_response and if so that message.group corresponds with the building group.
  • Make sure that this specific case is handled in your player script.

Hi Björn,

I solved it by creating a new vector. The collision was being detected correctly but the resolution of the collision was quite different from other engines that I am used to.

Hope you have a great weekend.

Cheers

How does it work on other engines?