Announcement

Collapse
No announcement yet.

Multiple Yaw Bones?

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

    Multiple Yaw Bones?

    I'm making driver-controlled weapons for a vehicle. One is a "rack" that actually has 2 weapons on it, but I want to treat them as 1. Think of it as a rack that goes left to right, with a weapon on each end. They will have the same pitchbone, but each needs it's own yawbone, since one will yaw around a different axis than the other, and I don't want to yaw the entire rack, just the weapons mounted on it. Does anyone know how to do this (Besides making it 2 seperate weapons). Thanks.

    #2
    There's the ONSLinkedWeapon approach as seen in the Cicada, but that's two different weapons...

    I think your best bet is placing an extra bone on the weapon and setting its rotation equal to the yaw bone in Tick using SetBoneRotation. Then you can just spawn projectiles at an offset for the alternate barrel.

    Comment


      #3
      seems manual setting the rotation on the second weapon doesn't work so well, because the weapons are fairly far apart. It makes it so if the target is close in and centered, the second barrel points outward, and the fire effects go inward. I guess what I need to do is calculate the weaponrotation based on the second weapon's location and the point of aim.

      I guess what I need to know is the vector that represents the location of where the player is aiming.

      Comment


        #4
        Originally posted by ghouck
        I need to know is the vector that represents the location of where the player is aiming.
        I think that's CurrentHitLocation. Gets used a lot in CalcWeaponFire for dual aim and stuff.

        Comment


          #5
          Thanks, after quite a bit I got it working, Seems I couldn't get the vector math straight for a while. Also, it sucks that to do this, you have to manually calculate and implement your pitch limits and yaw constraints. In the end, it all works though, Thanks.

          Comment


            #6
            One slight problem, but I'm not sure how much of a problem it is. Everything seems to work fine when I am in the Vec, but when I use the console command Freecamera 1, then the weapons point in different directions. I have yet to test this on the network, but I am wondering if this is indicative or some other problem. Please let me know if you have any ideas. Thanks.

            Comment


              #7
              No ideas about that, but have you considered making the actual gun invisible and just making two fake barrels that point in the same direction as the gun? I'd imagine all that is needed is a bit of SetBoneRotation work and some 3D math to calculate where the projectiles spawn. The invisible gun would handle all the yaw/pitch constraints.

              Comment


                #8
                I may have mis-worded something. There's 1 weapon, with 2 barrels. One barrel is controlled normally, the other is controlled through code. I See what you mean though, that might be the easiest way. I do have an extra bone I can use for that purpose. I'll try it when I get home. Thanks.

                Comment


                  #9
                  Did you ever look at the manual gun? Yes you can do what you want and move the bones to point where you want, however the manual gun does the same without so much complication.

                  /shrug

                  Comment


                    #10
                    I don't know what you mean by "manual gun".

                    Comment


                      #11
                      Onslaught\Classes\ONSManualGun.uc

                      I think this is different than what you want now that I've rethought what you said. In ONSManualGun.uc the entire body moves with the cursor which is not what I think you want.

                      I think you want something a bit like this:


                      However, the problem with having 2 guns split is aim. As you move the guns farther and farther apart the aim (cursor in your case I'm guessing is what you'd be aiming for) would be way off depending on how close/far the target is reletive to your position.

                      Comment


                        #12
                        Originally posted by ghouck
                        One slight problem, but I'm not sure how much of a problem it is. Everything seems to work fine when I am in the Vec, but when I use the console command Freecamera 1, then the weapons point in different directions. I have yet to test this on the network, but I am wondering if this is indicative or some other problem. Please let me know if you have any ideas. Thanks.

                        This brings us to your problem. Having a free camera and yet the weapons point different directions. Really, this all depends on how you coded the second weapon to move.

                        Comment


                          #13
                          AFAIK, the flackrat, and the cicada do the exact same thing. 2 weapons, on the sides of the vehicle, linked in a dual shoot fashion at the same target, but independant movment?

                          Comment

                          Working...
                          X