problem with my collision detection
I have a problem with the following code:
float exp_collision_detection_y(GLfloat x_move, GLfloat y_move, GLfloat z_move, GLfloat x_stay ,GLfloat y_stay, GLfloat z_stay,
GLfloat distance)
{
if (x_move>x_stay-distance && x_movey_stay-distance && y_movez_stay-distance)
{
y_move=y_stay-distance;
}
if (x_move>x_stay-distance && x_movey_stay+distance-0.04
&& z_movez_stay-distance)
{
y_move=y_stay+distance;
}
return y_move;
}
It is the y-axis part of my collision detection.
Here is an example:
At the begining y_stay = 0
, z_stay = -4
, y_move = 2
, z_move = -4
and distance = 2
Now i increase z_move up to -2 but then i can''t make y_move < 2. (I thing with the code above this should be possible)
But after increasing z_move > -2
, making y_move < 2
and then making z_move = -2
, i can set y_move and z_move at the values 2 and -4 (like at the begining)
and then i can increase z_move up to -2 and make y_move < 2 .
I think this is difficult to understand but i hope some one can help me!
This topic is closed to new replies.
Advertisement
Popular Topics
Advertisement