Rendering a weapon...

Started by
5 comments, last by Tobias 24 years ago
Hi, I just wonder if anyone knows how to render a gun like in QuakeX that always point in the same direction. I looked in the q1source how John did it, but that didn''t make me much wiser... There must be some good way the calculate the angle from the position and the lookat point of the camera... TIA, Tobias
Advertisement
The angle between the lookat vector and the weapon is always the the same, it doesn''t change when playing, if you mean this.


Visit our homepage: www.rarebyte.de.st

GA
Visit our homepage: www.rarebyte.de.stGA
Yes, but I want a way to calculate an x,y,z angle for my weapon so it points to the lookat point...

Greets Tobias
If your angle should depend on the distance of the point you look at, you must rotate your weapon about arctan(distance from viewpoint to weapon/distance from viewpoint to lookat point), the rotation axis must be normal to the lookat vector and normal to the vector viewpoint-weapon.

Visit our homepage: www.rarebyte.de.st

GA
Visit our homepage: www.rarebyte.de.stGA
You mean the little weapon you hold in front of you, right? For that, you dont perform ANY calculations on it (including camera). It should stay directly in front of you the whole time (assuming you defined the points correcly).

--TheGoop
quote:Original post by TheGoop
For that, you dont perform ANY calculations on it (including camera).

CAUTION, view matrix still applies



-kertropp

C:\Projects\rg_clue\ph_opt.c(185) : error C3142: 'PushAll' :bad idea
C:\Projects\rg_clue\ph_opt.c(207) : error C324: 'TryCnt': missing point
-kertropp C:Projectsrg_clueph_opt.c(185) : error C3142: 'PushAll' :bad ideaC:Projectsrg_clueph_opt.c(207) : error C324: 'TryCnt': missing point
I think TheGoop told you what you wanted to know because in quake (but also in all other 3d shooters I know) the weapon does not move relative to the player.

Visit our homepage: www.rarebyte.de.st

GA
Visit our homepage: www.rarebyte.de.stGA

This topic is closed to new replies.

Advertisement