how can i make my engine shoot like a normal game like quake3?

What do you mean?
You mean, take a gun and shoot?
Give any weapon a normal at which the patrons (?) exit. Randomly change it a bit. Take it as a line and look for any intersections with polys in world and models.
You could also take the gravity and the speed of the shot thing in account.

Of, course, if you would take speed in account, you’ll not take it as a line but as a bunch of straights (?). And then test wether this straight intersects any geometry.

how do i now where the gun is pointing at
at the centerof the screen duhh
but where is that
how can i calculate that?

You want to calculate the center of the screen/window? Err just do screenX/2 & screenY/2. That will put you in the center.

Or do you mean after you do some rotations? In that case, you can tell which direction your pointing by using a matrix, and taking elements 8,9,10 which will show you which direction your pointing. (but that is a bit advanced)

but can you please type the code
i know what you mean but don’t exactly know how to do that

Since I’m coping with OpenGL like matrices that is not correct. In that case, elements 3,7,11 will give the z-axis (which is front-vector for me).

Michael, is correct, it is 2,6,10.

(Oh, as for the code, x=scrnX/2 y=scrnY/2. Or did you mean the matrix way?)

[This message has been edited by Elixer (edited 01-12-2001).]

I was actually wrong. It has to be 2, 6 and 10.

how do i get those matrixes
en with the screen x and y coords
i don’t know how to calc the world coord for that point

I assume that you have any faces of the world defined in world coordinates. You have your position well defined.
I always have my own exemplar of the “fov” modelview matrix and load it up to opengl. But you can also get the matrix with glGetFloatv(…), I think.
Oh, and I made a mistake, it has to be the indexes 2,6,10, as elixer stated.

Well, to get a matrix from openGL pipeline, do: glGetFloatv(GL_MODELVIEW_MATRIX, mat); where mat is float mat[16].

For what it is worth, check out the long thread about this very subject about matrix.

To some it up, openGL matrix is:
0 4 8 12
1 5 9 13
2 6 10 14
3 7 11 15
1st 3 in row 1 =x 1st 3 in row 2=y and so on. Remember these are vectors. (xyz for each). 12,13,14 is the translation.
It is better to read other thread to understand better though.
So you want to take the z which is the direction, and add it to get new position of the particle your shooting.

[This message has been edited by Elixer (edited 01-13-2001).]

i had been having a lot of trouble understanding matrices as well, until i ran across these two articles online :

update:: (this is also a really good article)

so take a look at those, and hopefully things will be a bit clearer (oh by the way, i think there is an error in the 2nd article, it says that matrices in opengl are stored with the first row being 0,1,2,3 when i’m pretty sure the first row is 0,4,8,12… so just ignore that part

[This message has been edited by plucky (edited 01-14-2001).]

thanx i shall look at that now