Hi,
I'm struggling with a very annoying issue on AABB collision detection/ reponse in combination with Vsync.
In short:
- user presses arrow key, player moves in the right direction:
VECTOR3 movement = mPlayer.GetMovement() * mTimer.GetDelta();
- if the player collides with a wall, the player moves back to last position:
if(collides)
{
mPlayer.SetPosition(mPlayer.GetLastPosition()); // move back player
All so far so good, with Vsync enabled that is.
Now when I disable Vsync, I 'think' (and debugged :)) the following happens:
- the size of the movement vector (velocity) is so small that the increase in movement does not cause a collision, but the player moves 'inside the path'/ track in the maze
The goal I'm trying to achieve is that the player can only move 'the' paths, which works fine with AABB / AABB collision checking between the wall parts of the player, but only with Vsync enabled (because the movement amounts are then large enough to prevent moving basically between walls).
I also played around with the AABB of the player to fix it, but it just doesn't get accurate enough (and the AABB seems fine I guess, because with Vsync on it's all good).
The width/depth between walls is 100% sure/ Always 1.0f, this is the AABB size of the player I currently use:
mPlayer.ManualAABBUpdate(VECTOR3(-0.486f, -0.5f, -0.486f), VECTOR3(0.486f, 0.5f, 0.486f));
Any input to point me in the right direction is welcome.
I'd like so support both Vsync enabled and disabled in my game, so the user can decide.