Announcement

Collapse
No announcement yet.

Alternative barrel on vehicle weapon pawn?

Collapse
X
 
  • Filter
  • Time
  • Show
Clear All
new posts

    Alternative barrel on vehicle weapon pawn?

    I'm trying to get a (flare) projectile to originate at another point than the (flare launcher) weapon launching it. To be more precise, I want it to be fired from another (tank turret) weapon that has an extra (flare tube) barrel.

    The flare tube has a bone at the end for this purpose. I would like to spawn the flares at the location of this bone. How can I read the absolute location of this bone?

    Are there any other ways of achieving this goal? Can I, for example, map the flare launcher's WeaponBone to the flare tube's bone?

    #2
    Well, if you get a reference to the vehicle pawn, it should be simple. You could copy ProjectileFire's SpawnProjectile() and use the vehicle pawn's location and rotation instead of the player's.

    Comment


      #3
      So you want two barrels to track the same target, and to be able to fire from both barrels?

      Comment


        #4
        Originally posted by T-Bone7
        Well, if you get a reference to the vehicle pawn, it should be simple. You could copy ProjectileFire's SpawnProjectile() and use the vehicle pawn's location and rotation instead of the player's.
        I can get a reference, but the turret has a fire mode of its own and I don't want to mess with that. The turret has an extra barrel that I want to shoot the flares from.

        I suppose I might be able to derive the flare tube exit from the turret location and rotation with a bit of math, but I'd like to know if there's a more elegant variant, like getting the location and rotation of the bone.

        I plan to some day make a tank with a small turret that's stuck to the side of a big turret. So when the big turret turns, the small turret moves with it. For that, I need to be able to reference bones from outside the class.

        Originally posted by Hsoolien
        So you want two barrels to track the same target, and to be able to fire from both barrels?
        I'd like the driver to be able to fire flares from a tube stuck to a passenger turret. The flare tube does not have to track. It just points up at a fixed angle. It does, however, rotate along with the turret it's stuck to.

        Comment


          #5
          There is no easy way as such, I did something similar in OVP, allowing one person (be it driver or passanger) have multiple guns fired from the same seat.


          So as an example, a Goliath Driver could fire both the Cannon and the mini gun at the same time at the same place. a Modificaiton of that code would do exaclty what you want


          What I would do is:

          Make a gun that just points straight up by default. (give it DrawType=None, but make sure the mesh is still set to something..., else you get accesed nones.). Makes it main fire do nothing, and it's altfire do the flare.

          MAke sure that up tube has it's own bone (I think you have already )

          Then use a subclass of my linking class that would spawn and attach your gun to your passenger gun like so:
          Code:
          class yourmultigun extends WPN_OVPMultiWeapon;
          
          function BeginPLay()
          {
              super.beginplay();
          
              local int i;
          
              aAttachedWeapons[aAttachedWeapons.Length] = Spawn(class'yourpackage.yourflaregun', self,,Location);
              aAttachedWeapons[AttachedWeapons.Length-1].Instigator = ONSWeaponsPawn(Owner);
          
              for (i=0;i<VehicleBase.WeaponPawns.Length;i++)
                  if (VehicleBase.WeaponPawns[i] == class'yourpassangerpawnclass')
                      VehcileBase.WeaponPawns[i].Gun.AttachToBone(aAttachedWeaponPawns[aAttachedWeaponPawns.Length-1], BoneName);
          }
          //The follwoing jsust hacks my hack so your gun always points up :D
          
          function Tick(float DeltaTime)
          {
              local int i;
          
              for (i=0;i<aAttachedWeapons.Length;i++)
              {
                  if (i != aAttachedWeapons.Length-1)
                      aAttachedWeapons[i].SetRelativeRotation(self.CurrentAim);
          
                  if (abWeaponHot[i] == 1)
                  {
                      if ((aAttachedWeapons[i].FireCountdown - DeltaTime) <= 0)
                      {
                          aAttachedWeapons[i].FireCountdown = 0;
                          abWeaponHot[i] = 0;
                      }
                      else
                          aAttachedWeapons[i].FireCountdown = aAttachedWeapons[i].FireCountDown - DeltaTime;
                  }
              }
          }
          
          defaultproperties
          {
              aMultiWeapons(0)=(WeaponClass=class'YourPackage.MainTurretClass',WeaponBone=MainTurretBone);
          }
          In your vehicle your driver weapon would point to the above gun, you can attach it to any bone.

          OVP can be found here in it's most current flavor:
          http://www.ina-community.com/forums/...hreadid=441943

          Comment


            #6
            Cool! That sure gives me something to work with. Thanks!

            Comment

            Working...
            X