RipRoarinBoogerBenis
Member
Currently I am using a script to handle box collisions, however I an realizing I need my box collider to a rectangle, and to be rotatable, as to better simulate the movements of a vaguely oblong tank without things clipping into other things. Unfortunately, I think this would either involve having to calculate the rotation vector and add it into the acceleration or possibly use two colliders with linked velocities and I am wondering if there's a simpler solution that I am missing.
This is the current code I'm using:
I think I would need to do something like:
and then add that in to the current acceleration for the collision check.
I'm open to any solutions though.
This is the current code I'm using:
GML:
collisionVeloX= cos(angleDir*2*pi/360)*velocity;
collisionVeloY= -sin(angleDir*2*pi/360)*velocity;
xVelo = velocity;
yVelo = velocity;
if(place_meeting(x + collisionVeloX, y, obj_ow_nopass)){
while(!place_meeting(x+ collisionVeloX,y,obj_ow_nopass))
{
x+=collisionVeloX;
}
xVelo = 0;
}
if(place_meeting(x, y + collisionVeloY, obj_ow_nopass)){
while(!place_meeting(x, y+collisionVeloY,obj_ow_nopass))
{
y+=collisionVeloY;
}
yVelo = 0;
}
x+=cos(angleDir*2*pi/360)*xVelo;
y+=-sin(angleDir*2*pi/360)*yVelo;
I think I would need to do something like:
GML:
point_direction(oldAngle.x,oldAngle.y,newAngle.x,newAngle.y);
I'm open to any solutions though.