#### Archived

This topic is now archived and is closed to further replies.

# Rendering a weapon...

This topic is 6799 days old which is more than the 365 day threshold we allow for new replies. Please post a new topic.

## Recommended Posts

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

##### Share on other sites
The angle between the lookat vector and the weapon is always the the same, it doesn''t change when playing, if you mean this.

GA

##### Share on other sites
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

##### Share on other sites
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.

GA

##### Share on other sites
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

##### Share on other sites
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

##### Share on other sites
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.

GA

1. 1
Rutin
40
2. 2
3. 3
4. 4
5. 5

• 18
• 19
• 12
• 14
• 9
• ### Forum Statistics

• Total Topics
633362
• Total Posts
3011531
• ### Who's Online (See full list)

There are no registered users currently online

×