W
Wayfarer
Guest
I've noticed just now that collisions seem to only activate when an object is overlapping more than 50% of one pixel into the collision event object.
To explain that more clearly:
1. Say you have a player object moving downwards at 0.2 pixels a step. Directly below that you have a wall. Like, literally, right below it, so there's no gap.
2. Now assume there is a collision event for the player with the wall.
3. You might expect that the player would collide with the wall upon moving down 0.2 pixels the first step. However, this isn't the case! It's not until the third step, once the player is over 50% into the first pixel, that the collision event occurs.
So, in other words, the player doesn't collide with the wall until they're more than 0.5 of a pixel into it. I can't quite understand how I've only noticed this now.
I managed to figure a quick workaround by ceiling the y axis at the end of the step event, and then setting it back to it's correct value in the draw event. But I'm curious though, is this the best way to go about this? Is there a more logical way?
To explain that more clearly:
1. Say you have a player object moving downwards at 0.2 pixels a step. Directly below that you have a wall. Like, literally, right below it, so there's no gap.
2. Now assume there is a collision event for the player with the wall.
3. You might expect that the player would collide with the wall upon moving down 0.2 pixels the first step. However, this isn't the case! It's not until the third step, once the player is over 50% into the first pixel, that the collision event occurs.
So, in other words, the player doesn't collide with the wall until they're more than 0.5 of a pixel into it. I can't quite understand how I've only noticed this now.
I managed to figure a quick workaround by ceiling the y axis at the end of the step event, and then setting it back to it's correct value in the draw event. But I'm curious though, is this the best way to go about this? Is there a more logical way?