No announcement yet.

True JumpPad Velocity Code

  • Filter
  • Time
  • Show
Clear All
new posts

    True JumpPad Velocity Code

    My Actual Concern:
    I want code that will give velocity to a pawn right before it dies such that it's corpse is launched towards a specific point (toward's the killer)

    I was hoping to use whatever JumpPads use. But there are 2 problems to that.

    1st of all:
    Jump pads seem to be limited in their jumping distance. Is there some kind of air drag implemented in UT (yah right) or is it all due to rounding?
    What I mean is: if a jumppad is pointing at a faraway pathnode, it will not give the pawn enough velocity to reach it.
    Perhaps this is indication that the jumppad code is NOT the answer to my problem, making the rest of this post a waste of time. Read on if you dare.

    2nd of all:
    What is the jumppad algorithm anyway?

    JumpPads have a JumpVelocity datamember which it gives to the pawns who touch it. But how is it computed?

    I would guess that JumpVelocity is computed by some cpp code and not by unreal script. The only JumpVelocity related unreal script that appear is the following:
    (J is a JumpPad)
    XYDir = J.JumpTarget.Location - J.Location;
    ZDiff = XYDir.Z;
    Time = 2.5f * J.JumpZModifier * Sqrt(Abs(ZDiff/GravityZ));
    J.JumpVelocity = XYDir/Time;
    J.JumpVelocity.Z = ZDiff/Time - 0.5f * GravityZ * Time;
    This appears in

    But, just looking at the code, I am fairly sure this is not how JumpVelocity is really computed. If ZDiff = 0, then Time = 0. If Time = 0 then we are deviding by zero. However I made a map with jumppads and nodes with zero difference in height, and they worked mostly (except over long distances, as mentioned before).

    JumpPad.uc has the following code
    	void addReachSpecs(APawn * Scout, UBOOL bOnlyChanged);
    	void RenderEditorSelected(FLevelSceneNode* SceneNode,FRenderInterface* RI, FDynamicActor* FDA);
    But I do not know what this means. Let me know if anyone knows something about this.


    I guess that the main functions of jumppads are really implemented in C++ and not in UScript.

    The cpptext thingy was added by EPIC in the script-source to help coders to understand better how stuff works.
    "addReachSpecs" has something to do with the path-network which is used by the AI to navigate through the levels.
    "RenderEditorSelected": Well, I guess that this is the prototype for the function which renders the jumppad-symbol in the editor if it is selected^^

    I guess that the limited distance of jumppads have to do something with the max. fall-speed, max. velocity, or some other limit. But of course it also could simply be an limit-constant in the implementation of jumppads.

    For your "actual concern":
    -I don't know...
    -Damage-Types have a "KDeathUpKick"-variable, which specifies the amount of upwards kick the mesh gets.
    -The GameRules::NetDamage function has a "Momentum" parameter. It is a vector and it is declared as "out", so you could perhaps use it to toss the body in the correct direction. Didn't tried it, though...
    -Weapons also have a momentum-variable...
    -From Pawn:: Died: "Velocity.Z *= 1.3;" I guess this kicks the body a bit upwards.


      Originally posted by EdudDiputs View Post
      Jump pads seem to be limited in their jumping distance. Is there some kind of air drag implemented in UT (yah right) or is it all due to rounding?
      Yeah, there really is something like "air drag" implemented in a map ~~ determined by the value set to the FluidFriction property of the encompassing physics volume (a local volume actor, or the default physics volume actor)

      For JumpPad, xKicker etc, local z-axis gravity also has a dampening effect


        TerminalVelocity limits top pawn's speed, that's most likely why jumppad radius is limited - for far away jumps you'd need very high speeds.