Gunfire off center from crosshair.

If you know something thats not in here please share it

Re: Gunfire off center from crosshair.

Postby Apache Thunder » Sun Aug 30, 2015 10:19 pm

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. ;)
ImageImageImage

I have cameras in your head!
User avatar
Apache Thunder
 
Posts: 1195
Joined: Mon Oct 19, 2009 2:48 am
Location: Levelland Texas, USA

Re: Gunfire off center from crosshair.

Postby Kurosaji » Tue Sep 01, 2015 3:30 am

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.
Kurosaji
 
Posts: 59
Joined: Fri Aug 22, 2014 8:01 pm

Re: Gunfire off center from crosshair.

Postby Vilespring » Tue Sep 01, 2015 4:31 am

In a nutshell;
Attach camera to guns
A picture is worth a thousand words, but takes up three thousand times the memory.

Area 51: http://battlefieldarea51mod.weebly.com/

Image
"I didn't steal your pizza"
User avatar
Vilespring
 
Posts: 743
Joined: Sat Nov 24, 2012 5:47 am
Location: Somewere in the United States

Re: Gunfire off center from crosshair.

Postby Kurosaji » Wed Sep 02, 2015 12:26 am

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.
Kurosaji
 
Posts: 59
Joined: Fri Aug 22, 2014 8:01 pm

Previous

Return to Modding/Mapping Tutorials

Who is online

Users browsing this forum: No registered users and 2 guests

cron