Jump to content
  • Advertisement

Archived

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

Tobias

Rendering a weapon...

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

If you intended to correct an error in the post then please contact us.

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 this post


Link to post
Share on other sites
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

Share this post


Link to post
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 this post


Link to post
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.

Visit our homepage: www.rarebyte.de.st

GA

Share this post


Link to post
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 this post


Link to post
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 this post


Link to post
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.

Visit our homepage: www.rarebyte.de.st

GA

Share this post


Link to post
Share on other sites

  • Advertisement
×

Important Information

By using GameDev.net, you agree to our community Guidelines, Terms of Use, and Privacy Policy.

Participate in the game development conversation and more when you create an account on GameDev.net!

Sign me up!