Announcement

Collapse
No announcement yet.

Need help implementing a feature

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

    Need help implementing a feature

    I'm working on a weapon which uses HurtRadius to cause recoil (TransferMomentum). What I haven't been able to figure out is how to make the hurtradius effect only the person firing the weapon, and not anyone that may be standing close by but not in the line of fire. What I mean by recoil, is NOT shakeview, but rather an honest recoil effect, throwing the firer across the room. TIA

    #2
    Just add the following somewhere in your fire class:

    Code:
    function DoFireEffect()
    {
        local vector vRecoil;
    
        vRecoil.x = 500;
    
        instigator.AddVelocity(vRecoil);
    
        super.DoFireEffect();
    }

    You will have to play with vRecoil.x, and maybe .y and .z as well but eventually it should have a good kick.

    As a note:
    Code:
    AddVelocity ( Vector NewVelocity )
    is found in the Pawn Class, basically it kicks the player with whatever velocity you throw into it. I added it to DoFireEffect() since that seems to handle anything that results from firing the gun (ex. muzzle flash)

    Putting a negative value in x (as I did at first assuming a negative value would be opposit of your path of travel) will drag you forward, I'm sure this has potentinal somehow (just not sure how )

    Comment


      #3
      Woops, seems the value you plug in will always be done reltative to the world (I really need to test stuff better before I post.. , so I guess you'll have to adjust the value of vRecoil according to the direction the gun is pointed....


      I'm sure you can figure that part out...

      Comment


        #4
        Thanks, that's definately an easy way of doing what I was trying. Here's the sum of everything I worked out:

        local vector vRecoil;
        local Rotator D;
        D = Instigator.GetViewRotation();
        D.pitch = D.pitch -3000;
        vRecoil = (vector(D) * -750);
        instigator.AddVelocity(vRecoil);

        The "D.pitch = D.pitch -3000;" makes the direction of the recoil slightly up, so you get a little lift. Otherwise, if you're aiming at someone's head (slightly upwards), the recoil moves you into the ground and you get very little backwards motion. The 750 is the amount of recoil in this setup.

        Thanks a heap for the help.

        Comment


          #5
          Putting a negative value in x (as I did at first assuming a negative value would be opposit of your path of travel) will drag you forward, I'm sure this has potentinal somehow (just not sure how )
          Here's an example of how it can be useful (The forward drag).

          http://home.gci.net/~ghouck/EDCombo.zip

          Comment

          Working...
          X