(SOLVED) Player not moving when collision type is Dynamic

Hello,

after a few month I decided to have some fun with defold again. So I started with the “Moving astronaut” tutorial. After I finished it, my plan was to create a pacman clone. So I created a tilemap, tilesource and copied the astronaut as my player go. After a few hours of try & error, here I am.

I want the astronaut to stop at walls so that I am able to build a level where you can only go up, down, left and right (pacman style :wink: ). But as soon as I set the collisionobject from the astronaut to dynamic (I placed to Box as collider, too) the astronaut is not going to move anywhere.

My player.script is identical to the astronaut.script from the tutorial. If I set the collision type to Kinematic, I am able to move and the collision gets registered. But I have no idea how to stop the player at a wall.

I found some old community topics and tutorials but was not able to fix my problem, yet.

A little bit help or a push in the right direction would be awesome :slight_smile:

Maybe those Screens might help to clearify my setup.

A dynamic collision object is completely in the hands of the physic system. You can only move it by applying forces to it. It’s not a good choice for a pacman game. You should set the collision object to kinematic and then react to contact_point_response messages and use those to handle collisions (separating colliding objects etc). There’s a section in the manual that describes this.

2 Likes

That was a extreme helpfull advice. With the help of https://www.defold.com/manuals/physics/#_resolving_kinematic_collisions I was able to stop my player go when there is a collision.

4 Likes