Chaos Fusion
Member
So I'm working on a 3D platformer of sorts and I've run into a clipping issue with walls. Using the code from the old Gamemaker fps tutorial, I can get the character to slide along walls however If the player is moving too fast and collides with the corner of 2 wall objects, the player will clip into the wall they are facing. Depending on the players speed, they can even just pass through the wall as if it's not even there. What can I do to fix this?
From player object, if it collides with the objWall_Par
Before I made a small modification to the code, this issue never happened.
At this point, I don't understand what is causing it and any help would be appreciated.
From player object, if it collides with the objWall_Par
Code:
//Platform collision. Ensures the player doesn't phase through the platform if they are on top of it
if (z<other.zheight+8 && z >= other.zheight- 8 && (z_speed<=0))
{
if (action == action_jumping||action == action_fan)
{
if completed=false
{
action = action_normal;
}
}
//Force the player to be at the max height of the ground
z = other.zheight;
ground = true;
z_speed = 0;
}
//If above the zheight of the floor, ground = false as there is nothing is keeping the player from dropping from gravity
if (z>other.zheight )
{
ground = false;
}
//If player z position not on top of the wall object
if (z > other.zUnder && z<other.zheight)
{
//Prevent movement unless..
x = xprevious;
y = yprevious;
if (!place_meeting(x+hspeed,y,other))
{
x += hspeed;
}
else
{
x = xprevious;
}
if (!place_meeting(x,y+vspeed,other))
{
y += vspeed;
}
else
{
y = yprevious;
}
}
At this point, I don't understand what is causing it and any help would be appreciated.