Gunfire off center from crosshair.

If you know something thats not in here please share it
Kurosaji
Posts: 59
Joined: Fri Aug 22, 2014 8:01 pm

Gunfire off center from crosshair.

Post by Kurosaji »

I have been stumped on this issue for some time now. I have a helicopter type ship, and after a certain amount of time the 2nd gun position gets off center from the cross-hair. Thus, you have no idea where you are firing but to look at the tracers and bullet impact sites. Everything starts off fine, but when you start firing and the pilot is flying around, it starts to slip from the crosshair. This can be corrected by dragging your crosshair target as far to the bottom left of the screen as you can, after that it will re-align... temporarily.

Any ideas?
User avatar
Swaffy
Posts: 1715
Joined: Sun Aug 29, 2010 9:25 pm
Location: Cibolo, Texas

Re: Gunfire off center from crosshair.

Post by Swaffy »

Seems like your camera is moving at a slightly different rate than the gun. This can happen if they move separately, so if the camera was parented to the gun then the camera would be static on the gun and never move.

The Sexton from the vanilla game is an example for how the camera can move separate from the turret. You can easily see this by aiming left/right with the gun.

If this is not the issue, then I have no idea without seeing video footage. But look into what I said first before making a video.
(Forum Thread|Download) Swaffy'sMod v0.34 | Download link to come Soon™
User avatar
Vilespring
Posts: 740
Joined: Sat Nov 24, 2012 5:47 am
Location: Somewere in the United States

Re: Gunfire off center from crosshair.

Post by Vilespring »

You probably have the camera and the gun moving at a slightly different rates.

You could also add the fire in direction of camera line, but I don't remember it, the last modding I did was months ago, so I'm a bit rusty.
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"
Kurosaji
Posts: 59
Joined: Fri Aug 22, 2014 8:01 pm

Re: Gunfire off center from crosshair.

Post by Kurosaji »

Code: Select all

ObjectTemplate.addTemplate GunShipEntry
ObjectTemplate.setPosition 0/-1.2/-1.42359
ObjectTemplate.addTemplate GunShipFrontGun1
ObjectTemplate.setPosition -0.636679/-1.95135/6.34031
ObjectTemplate.addTemplate GunShipFrontGun2
ObjectTemplate.setPosition 0.666779/-1.95135/6.34031
rem ObjectTemplate.setRotation 0.0/12.9795/180.0
ObjectTemplate.addTemplate GunShipCameraMove
ObjectTemplate.setPosition 0/-0.8/9
rem -------------------------------------
ObjectTemplate.setSoldierExitLocation 0/-1.2/-1.42359 0/0/0
ObjectTemplate.setVehicleIcon "Vehicle/Icon_gunship.dds"
ObjectTemplate.setVehicleIconPos 27/65
ObjectTemplate.setNumberOfWeaponIcons 1
ObjectTemplate.setPrimaryAmmoIcon "Ammo/icon_greenlaser_64x64.tga"
ObjectTemplate.setPrimaryAmmoBar ABHeatBarOnly
ObjectTemplate.setCrossHairType CHTIcon
ObjectTemplate.setVehicleCategory VCLand

rem *** CoPilot Turrents ***
ObjectTemplate.create RotationalBundle GunShipFrontGun1
ObjectTemplate.setNetworkableInfo repgun_turrent_Info
ObjectTemplate.loadSoundScript Sounds/TurretRotate.ssc
ObjectTemplate.geometry gunship_fturret_left
rem -------------------------------------
ObjectTemplate.addTemplate GunShipFrontLaser
rem -------------------------------------
ObjectTemplate.setMinRotation -35/-25/0
ObjectTemplate.setMaxRotation 35/70/0
ObjectTemplate.setMaxSpeed 15/15/0
ObjectTemplate.setAcceleration 5000/5000/0
ObjectTemplate.setInputToYaw c_PIMouseLookX
ObjectTemplate.setInputToPitch c_PIMouseLookY

ObjectTemplate.create RotationalBundle GunShipFrontGun2
ObjectTemplate.setNetworkableInfo repgun_turrent_Info
ObjectTemplate.loadSoundScript Sounds/TurretRotate.ssc
ObjectTemplate.geometry gunship_fturret_right
Thats prob what what im looking at needing to adjust, though I know it is a good deal excess information posted. One thing I fear is that if the camera matches the gun I may see inside the model, but I will have to see when I cross that bridge. Anything you see here?
freddy
Posts: 1267
Joined: Sun Oct 18, 2009 4:58 pm

Re: Gunfire off center from crosshair.

Post by freddy »

You can try adding objectTemplate.fireInCameraDof 1
Kurosaji
Posts: 59
Joined: Fri Aug 22, 2014 8:01 pm

Re: Gunfire off center from crosshair.

Post by Kurosaji »

that actually seems like it could work, unless someone has doubts? I'm not sure, is that only needed in weapons.con, or objects as well? The script I posted above is from objects, just to clarify.
User avatar
Vilespring
Posts: 740
Joined: Sat Nov 24, 2012 5:47 am
Location: Somewere in the United States

Re: Gunfire off center from crosshair.

Post by Vilespring »

It's not enough for me to tell what's up. give me the whole thing's objects, weapons and all.
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"
Kurosaji
Posts: 59
Joined: Fri Aug 22, 2014 8:01 pm

Re: Gunfire off center from crosshair.

Post by Kurosaji »

freddy
Posts: 1267
Joined: Sun Oct 18, 2009 4:58 pm

Re: Gunfire off center from crosshair.

Post by freddy »

In weapons.con at the bottom of the weaponcode

example for the GunShipBubbleLaser

Code: Select all

ObjectTemplate.create FireArms GunShipBubbleLaser
-div code-
ObjectTemplate.AmmoType	10
ObjectTemplate.fireInCameraDof 1
With this code it doesnt matter where the gun is pointing, it always fires at the center of the crosshair. Worth a try :)
Kurosaji
Posts: 59
Joined: Fri Aug 22, 2014 8:01 pm

Re: Gunfire off center from crosshair.

Post by Kurosaji »

well, it works in theory.... however...

Code: Select all

rem -------------------------------------
rem ObjectTemplate.visibleBarrelTemplate e_greenbeam
rem -------------------------------------
ObjectTemplate.projectileTemplate BeamLaserProjectileGreenS
ObjectTemplate.magSize -1
ObjectTemplate.magType 0
ObjectTemplate.numOfMag 999
ObjectTemplate.velocity 1200
ObjectTemplate.reloadtime 0.1
ObjectTemplate.roundOfFire 10
ObjectTemplate.addFireArmsPosition 0/0/4 0/0/0
ObjectTemplate.setInputFire c_PIFire
REM *** OVERHEAT *** 
objectTemplate.heatAddWhenFire 0.2
objectTemplate.coolDownPerSec 0.7
objectTemplate.timeDelayOnOverHeat 0.2
REM *** DAMAGE OVER DISTANCE ***
ObjectTemplate.minDamage 0.5
ObjectTemplate.distToStartLoseDamage 100
ObjectTemplate.distToMinDamage 300
ObjectTemplate.AmmoType   10

ObjectTemplate.create FireArms GunShipFrontLaser
ObjectTemplate.loadSoundScript Sounds/FrontLaser.ssc
ObjectTemplate.setNetworkableInfo PlaneFireArmInfo
rem -------------------------------------
ObjectTemplate.visibleBarrelTemplate e_MuzzHeavy
rem -------------------------------------
ObjectTemplate.projectileTemplate MediumLaserProjectileGreenNS
ObjectTemplate.magSize -1
ObjectTemplate.magType 0
ObjectTemplate.numOfMag 999
ObjectTemplate.velocity 650
ObjectTemplate.reloadtime 0.1
ObjectTemplate.roundOfFire 5.3
ObjectTemplate.addFireArmsPosition 0/0/2 0/0/0
REM *** OVERHEAT *** 
objectTemplate.heatAddWhenFire 0.07
objectTemplate.coolDownPerSec 0.5
objectTemplate.timeDelayOnOverHeat 3
REM *** DAMAGE OVER DISTANCE ***
ObjectTemplate.minDamage 0.5
ObjectTemplate.distToStartLoseDamage 100
ObjectTemplate.distToMinDamage 300
ObjectTemplate.AmmoType   10
The problem here is that they are separate guns bound to 1 position. So you have 2 straight firing lasers which are parallel to each other (basically touching). They don't fire in a cross intersect pattern. So what happens with

Code: Select all

ObjectTemplate.fireInCameraDof 1
causes the 2 lasers to share the same screen space. I cant think of a script that would do this.
Post Reply