Page 1 of 3

Gunfire off center from crosshair.

Posted: Mon Aug 10, 2015 7:43 pm
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?

Re: Gunfire off center from crosshair.

Posted: Tue Aug 11, 2015 2:36 am
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.

Re: Gunfire off center from crosshair.

Posted: Tue Aug 11, 2015 3:52 am
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.

Re: Gunfire off center from crosshair.

Posted: Tue Aug 11, 2015 2:34 pm
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?

Re: Gunfire off center from crosshair.

Posted: Wed Aug 12, 2015 1:42 pm
by freddy
You can try adding objectTemplate.fireInCameraDof 1

Re: Gunfire off center from crosshair.

Posted: Wed Aug 12, 2015 2:59 pm
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.

Re: Gunfire off center from crosshair.

Posted: Wed Aug 12, 2015 8:33 pm
by Vilespring
It's not enough for me to tell what's up. give me the whole thing's objects, weapons and all.

Re: Gunfire off center from crosshair.

Posted: Thu Aug 13, 2015 12:44 am
by Kurosaji

Re: Gunfire off center from crosshair.

Posted: Thu Aug 13, 2015 7:05 am
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 :)

Re: Gunfire off center from crosshair.

Posted: Fri Aug 14, 2015 1:48 am
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.