Collision Point Expressions

It would be really nice to have something like an expression thats like Object1.CollisionPointX(Object2) and ofc Object1.CollisionPointY(Object2)

How it would work

Object1.CollisionPointX(Object2)
Object1.CollisionPointY(Object2)
Object1.CollisionPointRightX(Object2)
Object1.CollisionPointUpY(Object2)
Object1.CollisionPointLeftX(Object2)
Object1.CollisionPointDownY(Object2)

What would happen if its not just edges touching

How you could implement it:

https://games.gdevelop-app.com/game-9776f2a7-ecd2-4750-93f3-fb57a32183ad/index.html?userSlug=cokiesyum&gameSlug=collision-points-example

Additional:

Object1.CollisionArea(Object2) - This shows the area of where its touching
Object1.CollisionLength(Object2, x or y) - This shows the lenght of either the x or y

4 Likes

I get what you are asking for and can see how it being useful or even life saver in some scenarios
Instead of your approach i would go with

Object1.CollisionPointXLeft(Object2)
Object1.CollisionPointXCenter(Object2)
Object1.CollisionPointXRight(Object2)

Object1.CollisionPointYTop(Object2)
Object1.CollisionPointYCenter(Object2)
Object1.CollisionPointYBottom(Object2)

1 Like

That’s really cool idea

1 Like

Yess! but it should even work with collisions with the same instance

Hi, is this to check if object1 is in collision with object2 on its top, bottom, left or right side?

Almost !! :DD its to see where its touching :DD

So to get the exact point it’s touching

I prefer something like tagging collision masks.
For example, a collision mask for the “head” and a collision mask for the “foot”, and if the “head” collision mask is in collision with the “foot” collision mask of another object, damage occurs.

Remember folks, one feature request per thread so it doesn’t get lost (and to adhere to the forum rules)

@EyadMahm0ud , what you are asking for is uniquely addressable collision masks, which is outside of what is being asked in this thread, but I think this other features request might be closer to what you are looking for. Handle multiple collision masks independently - #2 by Rasterisko

1 Like