Jump to content
  • Advertisement


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


fps camera moving\shooting

This topic is 5678 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

Important Information

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

GameDev.net is your game development community. Create an account for your GameDev Portfolio and participate in the largest developer community in the games industry.

Sign me up!