GMS 2 [SOLVED] Physics_Test_Overlap

Alloi

Member
I have a parent object named oBlock. Then I have 2 children objects, one named oPlayer1 and the other oPlayer2.

I am trying to have it so collision is detected if the other jumps onto their head. My issue is that when using "physics_test_overlap(x,y,image_angle,oBlock)" a collision is always detected, even when it is not touching other objects. I assume it is counting itself in the collision here.

Second issue is if I do "physics_test_overlap(x,y+vspeed-1,image_angle,oPlayer2)" inside of oPlayer1's code, and vise versa in oPlayer2, a collision for the one on top will be made if it is travelling quickly into the other object, when only the one on bottom should be accepting it.

What are some ways I can prevent that? I've looked into using place_meeting etc with minimal luck.

Any help is appreciated, thank you in advance.
 

Alloi

Member
Found a solution using collision_rectangle().
If there is a better way, please let me know.

I set up '
collision_rectangle(x-20,y-34,x+20,y, oBlock, true, true)' on the parent object and it works great for only activating collisions on the top and mostly middle of the block.

However I do foresee an issue if I want to check for collisions while the
oBlock object is rotated 45 degrees.
 
Top