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?
Fire velocity and position
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.
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.
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.
“If I understand the standard right it is legal and safe to do this but the resulting value could be anything.”
This topic is closed to new replies.
Advertisement
Popular Topics
Advertisement
Recommended Tutorials
Advertisement