graphics - OpenGL Collision Detection -


I am currently working on designing my first FPS game using JOGL. (Java binding for OpenGL).

So far, I am capable of producing 'World' (a series of cubes), and a player model. I have a great job of detecting conflicts between players and Cubes.

Now I am trying to add guns. I have a properly designed model and loading on the player model. The first gun I am trying to implement is a laser gun, which is what you are targeting, before shooting and implementing the instant line-of-sight laser enemy model, I have laser and walls I would like to explore the collision between

My laser, currently, is pulled by a series of small cubes, one after the other. The first cube is drawn at the end of the gun of the players, then it is coming continuously from there. This idea was to continue to illustrate laser cubes, unless the conflict with anything is known, Cubes in the world.

I know the places of the world's cubes. The problem is that I have to call glMatrixPush to attract my character model. The laser is pulled within this modelview. Which means that I have lost my old coordination system - so I am pulling the world in a system, then in the second laser. Within this player's matrix, I often call gloal and glyanslate so that the camera is moving, the way in which everything can be synced. The laser is then made by translating this new system with the z-axis.

My problem is that through all these changes, I no longer have any ideas, where my laser map is present in the coordination system, primarily because of the rotation associated with the camera.

Does anyone detect a method - or have any problem, how to solve this problem? I believe I need to convert the new coordinate laser to the old coordinates of the map, but I'm not sure how to go about eliminating all its changes. There may also be some functionality provided by OpenGL to handle this kind of problem.

The issue that is being raised in the first answer is that for the position of the object in the first place Should not be dependent on the matrix. You should also think about dragging the laser's position and before rotation is tracked. Then you use the translation and where to place it, it must be placed to rotate the order.

You are trying to get things backwards, and yes, that means you have to do matrix math, and OpenGL does not keep an eye on it because the modelView matrix is ​​the only thing that is openGL object Keeps track of posts. There is no concept of OpenGL's "World Space" or "Camera Space". Only matrix that all input is multiplied is very simple ... but in some cases I have different view metrics and models of AAL of DirectX I like the matrix.

So, if you do not know where the object matrix is ​​located without mathematics, then I think that the problem of a basic design is that if you need to find the position of the object < Em>, then change the matrix-transform into your heart's content, but if you need a situation, start with the status.

(A lot of what the first answer is saying, just in a different way ...)


Comments

Popular posts from this blog

python - Overriding the save method in Django ModelForm -

html - CSS autoheight, but fit content to height of div -

qt - How to prevent QAudioInput from automatically boosting the master volume to 100%? -