Page 3 of 3

Re: Gunfire off center from crosshair.

Posted: Sun Aug 30, 2015 10:19 pm
by Apache Thunder
The slippage may be that the camera is not near the center of mass of the turret, so from certain directions, projectiles seem to fire further off from what you intended. There are two ways to fix this. First, you could simply attach the camera to the turret and move the camera forward/down/up until the turret mesh no longer obstructs your view (I would suggest you go with this option). Second you can try moving the camera so that it's near the center of mass for the turret. (it can still be off by one axis. On the vertial axis you can have it a few meters above the turret (or below) depending on where you currently have the camera)


The best fix is to simply make the camera stationary and attach it as a child object to the turret with the gun. You may have to tweak the position to prevent meshes from blocking your view, but currently it's the only surefire way of resolving your issue. I generally avoid having the camera move on it's own with setups like this in my mods as it will inevitably result in the issues you mentioned.. It can become a bigger problem in multiplayer too. I haven't tried this, but you can also try adding network info to the camera object. This should ensure it will move at the same rate as the turret (which should also have network info by the way) in multiplayer. Adding network code to the camera object is a last resort. I highly recommend you just make the camera a child object of the turret. (remove the rotation/speed code from your camera afterwords. You don't have to set them to zero. Just remove all the commands for movement like setPosition, setRotation, setAcceleration, etc. These commands are zero by default if you leave them undefined so no need to specify them with zeros. :P )

If you end up making it a stationary camera that is a child object of the turret, you won't need to add network code to the camera FYI. The turret moves the camera for you and the turret should already have netcode on it. You can offset the camera on any axis you like. It will offset the fire direction a little depending on how far you have to offset it (but small changes within a meter or so shouldn't cause issue for aiming), but at least the aim will always be consistent no matter where you aim at. ;)

Re: Gunfire off center from crosshair.

Posted: Tue Sep 01, 2015 3:30 am
by Kurosaji
I am going to be honest... you lost me... Apache, you are way smarter than I am.
I might post a video of this so people have a better idea somewhat of how the vehicle functions in tandem with the weapon. I might be shit out of luck on this, this one is way out of my league.

Re: Gunfire off center from crosshair.

Posted: Tue Sep 01, 2015 4:31 am
by Vilespring
In a nutshell;
Attach camera to guns

Re: Gunfire off center from crosshair.

Posted: Wed Sep 02, 2015 12:26 am
by Kurosaji
I shortened down a video here to show progression, and how bad it gets at the end. https://youtu.be/0riJpgZbvNg I spliced it down to less than 50 seconds, but it took just over a minute and forty seconds to get as bad as it did lol.

Pretty sure I am too n00b for any kind of script like that - would love input.