FPS shooting help

You can write your topic however you want, but you need to answer these questions:

  1. What do you want to achieve? Keep it simple and clear!
    I’m making an FPS game, where the bullets come out of the muzzle of the gun even when you move side to side. I want to see if anyone else had a similar issue and if you managed to “fix” it.

  2. What is the issue? Include screenshots / videos if possible!
    If you look at the video provided, when you move side to side, it look like the bullet is coming out from the size opposite which you are moving.

  3. What solutions have you tried so far? Did you look for solutions on the Developer Hub?
    I’ve tried getting which way the player is moving and adjusting it via an offset, but i found that was quite inefficient and didn’t work as I expected.

(https://gyazo.com/973979fcf737e10b340f34c0f32ef900)

It’s probably the order that you reposition the gun vs read the muzzle position each frame.

If you do:

  1. Process “fire” input
  • Read gun position
  • Create projectile from gun position
  1. Set gun position to camera

In that order, then the projectiles will always look like they’re coming out of wherever the gun was the previous frame. You need to update the gun’s position BEFORE reading it each frame.

1 Like

Can you explain this more in depth? I don’t quite understand by setting the gun position to the camera. If you wish for me to provide you with some of my code, I’d be happy to do so.

Also, the tracer is handled on the client while damage and gravity are accounted for in a server script, as to not create too much strain on the server end. I don’t know if this is what is causing it or not.