Jump to content

  • Log In with Google      Sign In   
  • Create Account

Awesome job so far everyone! Please give us your feedback on how our article efforts are going. We still need more finished articles for our May contest theme: Remake the Classics

Fire velocity and position


Old topic!
Guest, the last post of this topic is over 60 days old and at this point you may not reply in this topic. If you wish to continue this conversation start a new topic.

  • You cannot reply to this topic
3 replies to this topic

#1 KurtO   Members   -  Reputation: 210

Like
0Likes
Like

Posted 30 August 2012 - 02:58 PM

I am making a FPS game and have encountered a problem when getting the fire vector and fire startPosition.

if i subtract my viewVector - posVector = the direction from me to center. But i then want to get the point that is in the right corner so my fire goes from corner to center.

how can i do this?

#2 jefferytitan   Members   -  Reputation: 1006

Like
0Likes
Like

Posted 30 August 2012 - 03:04 PM

What engine/SDK are you using? Some might have dedicated methods for similar things, others not so much. Or you could have a gun object which is connected to your camera with a 3D offset, and just experiment until it looks right. Then shoot from the position of the gun rather than the camera.

#3 Bacterius   Crossbones+   -  Reputation: 3518

Like
0Likes
Like

Posted 30 August 2012 - 06:03 PM

If you use a gun model, give the model a "muzzle point" (if it doesn't already have one) which is the location the bullet should exit the gun, and transform it into world space upon rendering, that'll give you the correct initial position from which to subtract the target's position to get the fire vector for your physics simulation.

If the point is properly placed and your gun is on-screen it'll look like the bullet came from the gun (since it effectively did) instead of from the center of the camera.

"The best comment is a deleted comment."
website · blog

[maintenance in progress]


#4 KurtO   Members   -  Reputation: 210

Like
0Likes
Like

Posted 01 September 2012 - 12:31 PM

Bacterious, thanks i will try this approach!




Old topic!
Guest, the last post of this topic is over 60 days old and at this point you may not reply in this topic. If you wish to continue this conversation start a new topic.



PARTNERS