place_meeting on Polygon mode checks using instance's current place and not expected place
Reporter: HitCoder9768 | Status: open | Last Modified: May 29, 2022, 10:16:24 pmDescribe the bug
when using place_meeting the arguments supplied are X, Y and object to check collisions with.
The object calling place_meeting will use it's own bounding box to check collisions.
Currently supplying X and Y does not offset the position the collision is checked, meaning objects will get stuck inside of other objects
Steps To Reproduce
some sample code that can be used on an object to check this bug
/// ===== CREATE EVENT ========= ///
/// initialisation and vars
spd=6; //max speed
acc=1; //acceleration
vel=0; //current velocity
/// ===== STEP EVENT ============ ///
/// movement
// check keys pressed and accelerate, otherwise decellerate
if(!(keyboard_check(vk_left) || keyboard_check(vk_right) || keyboard_check(vk_up) || keyboard_check(vk_down))){
vel=max(vel-acc,0);
}else{
vel=min(vel+acc,spd);
}
/// collisions
// change position of object based on velocity values
if(!place_meeting(x+cos(degtorad(direction))*(vel+1),y-sin(degtorad(direction))*(vel+1),objWall)){
x+=cos(degtorad(direction))*vel;
y-=sin(degtorad(direction))*vel;
}
/// ===== ANY KEY EVENT =========== ///
//movement
// check button pressed and set the direction value accordingly
if(keyboard_check(vk_left)){
AnimCurrent=AnimWalkLeft;
// Diagonal movement
if(keyboard_check(vk_up))
direction = 135;
else if(keyboard_check(vk_down))
direction = 225;
else
// normal movement
direction = 180;
}else if(keyboard_check(vk_right)){
AnimCurrent=AnimWalkRight;
// Diagonal movement
if(keyboard_check(vk_up))
direction = 45;
else if(keyboard_check(vk_down))
direction = 315;
else
// normal movement
direction = 0;
}else
if(keyboard_check(vk_up)){
AnimCurrent=AnimWalkUp;
direction = 90;
}else
if(keyboard_check(vk_down)){
AnimCurrent=AnimWalkDown;
direction = 270;
}
Expected behavior
place_meeting should check a collision at the supplied coordinates and not the calling object's coordinates.
Game files & Screenshots
The following project is a port of a project i made in GMS2 for school in 2017 to enigma
College_game.gmx.tar.gz
ENIGMA Configuration:
- Endeavour OS (Arch, LINUX510)
- Occurs on Polygon collision engine
Leave a commentView this issue on GitHub
Please sign in to post comments, or you can view this issue on GitHub.