Need help with collisions for coursework

So I’ve been trying to make a game after completing all the planning stages and I’ve spent around 7 hours now trying to fix collisions which is really becoming a pain to fix,

I’ve tried around 13 different solutions and now I’m asking because I’m either missing something or I don’t know why I just cant get it to work ill attach screenshots of everything related so maybe I messed up some property settings someone can point out,

I’m very new to defold this is my first project that wasn’t a tutorial




image

Looks like a mismatching group or mask issue. Wall and Default must be in same group/ mask:

Also:

3 Likes

That, plus you seem to have forgotten the function on_message(self, message_id, message, sender) to handle the collision message and resolve the collision. I only spot code for moving the player in the images you posted.
Example:

2 Likes

thanks for the reply, so ive fixed my group/mask and now tried different codes for the collision and im getting results but they arent what im aiming for do you know any, ive look on around 7 more forms to try find something that works for me or explains but at the moment i just cannot figure out whats going wrong

Do you need help figuring it out? If that is the case then you need to start sharing screenshots and code and also explain what you have tried, what exactly isn’t working etc

yes that would be appreciated, ill share the screenshots so far the collision has semi worked now i have everything suggested sorted, but issue is on some parts, my player will only collide half way though the wall or on the opposite side it collides half a wall too soon or even on the upper walls my player starts like lagging everywhere ill share screenshots of related code and property’s and after those the results I’m getting at the moment.






##Results##


image
image

result when sprinting into wall below, the red scribble is the path seems i cannot record on this computer to make a gif
image

Please enable physics debugging and post a screenshot of how it looks in game when you collide with a wall:

The collision object configuration looks ok.

The collision resolution go.get_position() - message.normal * message.distance is somewhat naive. It may or may not work depending on the complexity of the collisions. A better solution is this:

Also make sure to share code as described in the link below, rather than sharing screenshots.

Makes it much easier to read!

2 Likes

Sorry for being quiet for 2 weeks i caught covid and’ve been too ill to continue but anyways, after looking around ive managed to fix the collision in terms of how its handled (thanks for the links britzl) but i still have the issue of the map collision being off,

when im on my home computer ill share the logs and for now ill show screenshots of the maps collision points below:

image
image
image
image


if I’m missing any important information for help please let me know and ill reply with it when I’m on my home computer, but as you can see from screenshots any walls east have collision half way though and its the opposite on the west, walls collision hangs far over tiles, but south and north are completely fine.

also i forgot the screenshot with physics debugging as you can see here the box for the map is entirely off for the walls could this be an issue with my tiles or engine version?

image

the character hitbox is not aligned but thats a issue due to me not polishing it yet

never mind i changed some of the boarding settings with tile source and after nothing worked i changed it back to my original settings and its suddenly all fixed, thank you everyone who chipped in! i appreciate your time!

4 Likes