Sinister physics engine experience

Hi,

I’m trying to follow some instructions found on Youtube, but there’s something very strange happening

The ground is static and the player is dynamic, I was running some tests on Defold to see how I could handle gravity.

How can I fix this?

1 Like

I would start by enabling physics debugging in game.project to see what’s going on:

It may give you some clues as to why this is happening. You will clearly see what your physics shapes look like and if/how they interact.

I would also check the physics settings in game project. What is the physics scale and gravity? Physics scale should be around 0.01 and gravity -500 to -1000. More here:

2 Likes

I never was too fond of debugging in my programs, but sometimes it comes in handy. Somehow I can’t add physics to that area?

How is the collision shape defined? It looks like it is part of a tilesource, is this correct? And the collision object is somehow offset from the tilemap itself. I’m not entirely sure how that can happen.

Are you able to share the project as a zip file? (exclude the build and .internal folders)

defold_platformer_tutorial.zip (127.3 KB)

I’ve added some tilesources to Collision Group and they have been highlighted

Ok, so it was like I guessed:

I was actually a bit surprised at first but now that I think of it it makes sense. In your project you have moved the tilesource component 64 pixels to the left. This offsets the visual representation in the tilesource from the collision shape:

What you should do instead is to move the entire game object with the tilemap and the collision object:

4 Likes

Wow, thanks! It’s kinda strange. Anyway, It makes sense.