Jump to content
  • Advertisement

Archived

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

Bruno

fps camera moving\shooting

This topic is 5315 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'm tryng to shoot a projectile in the direction the camera is facing, and in the direction of a aim cursor wich is in the center of the screen., however i'm having some problems. Altough the camera rotates nicely, and i shoot in the same direction, when i move the camera up or down, the shooting won't hit the target, if i move up i hit a bit below, if i move down, i hit a bit above.., i'm not sure what's wrong with this, but it seems to me it is an angle problem.., Here it is my camera rotating function : look.pos_before = look.pos Radius = float(( ( look.xrot + (heading + 180) ) * 3.14159f / 180.0 )); look.pos[0] -= float(sin( Radius ) * velocity); look.pos[2] -= float(cos( Radius ) * velocity); That piece of code, moves the camera along the Y axis., To shoot, i use this : SCALE_F = 3.14159f / 180; Shoot[shot_number].Radius = float(( ( myCamera.look.xrot + (myCamera.heading + 180) ) * 3.14159f / 180.0 )); Shoot[shot_number].ini = Shoot[shot_number].pos; Shoot[shot_number].dirx = float(sin( Shoot[shot_number].Radius ) * B_Speed)*TimeFrame.speedfactor; Shoot[shot_number].diry = float( (- myCamera.lookupdown * SCALE_F ) * B_Speed)*TimeFrame.speedfactor; Shoot[shot_number].dirz = float(cos( Shoot[shot_number].Radius ) * B_Speed)*TimeFrame.speedfactor; Shoot[shot_number].xrot = 0; Thanks for any help, Bruno [edited by - Bruno on March 28, 2004 1:35:39 PM]

Share this post


Link to post
Share on other sites
Advertisement

  • Advertisement
×

Important Information

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

We are the game development community.

Whether you are an indie, hobbyist, AAA developer, or just trying to learn, GameDev.net is the place for you to learn, share, and connect with the games industry. Learn more About Us or sign up!

Sign me up!