Note that there are some explanatory texts on larger screens.

plurals
  1. POComputing AABB collision
    primarykey
    data
    text
    <p>I'm making a game in OpenGL. The game consists on a plane flying free on a 3D world, wich has to go through some especific areas, like if it was going through windows. Right now, I'm trying to compute the collision of the plane with that mentioned "windows". I thought as a first approach, to have an swept AABB for the trajectory of the plane, and some AABBs for each window, such as if these AABB overlaps, there are potencial cases of the plane going through it. But the problem starts when I try to calculate the AABBs, since every algorithm I know needs to know the coordinates of both objects (plane+window) in the same reference system. My program draws the world as if it is what's moving, instead of the plane, which is centered always at the origin (actually, at z=-10, so it's rendered). The real problem is how to compute the coordinates of each "window" as seen from the plane. This is the code I use to draw the scene:</p> <pre><code>glLoadIdentity(); //these are the rotations of the plane of the ground glRotatef(RotHorizont, 0.0f, 0.0f, 1.0f); glRotatef(-directionX, 1.0f, 0.0f, 0.0f); glRotatef(-directionY, 0, 1.0f, 0); //and these are the movement of the plane //(the multiplication by 0.0174532925f is to convert the angles to radians Tx -= (float)Math.sin(directionY * 0.0174532925f) * velocity; Tz -= (float)Math.cos(directionY * 0.0174532925f) * velocity; Ty -= (float)Math.sin(directionX * 0.0174532925f) * velocity; glTranslatef(-Tx, Ty, -Tz); /* here I draw the ground and the windows */ .... //and now I draw the plane gl.glLoadIdentity(); gl.glTranslatef(0.0f, 0.0f, -10.0f); /* draw the plane */ </code></pre> <p>So, how the heck do I get the coordinates of the "windows"? Or is there some other way to compute the collision? I really need your help, I will appreciate it so much. Thank you all!</p>
    singulars
    1. This table or related slice is empty.
    1. This table or related slice is empty.
    plurals
    1. This table or related slice is empty.
    1. This table or related slice is empty.
    1. This table or related slice is empty.
    1. This table or related slice is empty.
 

Querying!

 
Guidance

SQuiL has stopped working due to an internal error.

If you are curious you may find further information in the browser console, which is accessible through the devtools (F12).

Reload