Announcement

Collapse
No announcement yet.

Gravity Trigger

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

    Gravity Trigger

    Working in UT 2004 and have all the up to date patch's.
    I have been working with the UT editor for a little over a year now, and I have recently decided to dive into its script editor to make some triggers, mutators, etc.
    Anyway the level i am currently working on, I want to give control of the stages gravity to the player via a UseTrigger and the Gravity Trigger. Everything works fine except that one the gravity is turned way way down, it wont go back to normal. Anything suggestions would be appreciated.

    The following is the code of the default gravity trigger:


    class GravityTrigger extends Triggers;

    var() float GravityZ;
    var() name VolumeTag;


    event Trigger( Actor Other, Pawn EventInstigator )
    {
    local PhysicsVolume PV;
    local vector XYDir;
    local float ZDiff, Time;
    local JumpPad J;
    local NavigationPoint N;


    ForEach AllActors(class'PhysicsVolume', PV, VolumeTag)
    {
    // Change Physics Volume Gravity
    PV.Gravity.Z = FMax(PV.Gravity.Z, GravityZ);
    PV.NetUpdateTime = Level.TimeSeconds - 1;
    PV.bAlwaysRelevant = true;
    PV.RemoteRole = ROLE_DumbProxy;

    if ( PV.IsA('DefaultPhysicsVolume') )
    Level.DefaultGravity = PV.Gravity.Z;

    // Adjust JumpPads
    for ( N=Level.NavigationPointList; N!=None; N=N.NextNavigationPoint )
    if ( N.IsA('JumpPad') && PV.Encompasses( N ) )
    {
    J = JumpPad(N);
    if ( J != None )
    {
    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;
    }
    }
    }
    }

    #2
    I think that trigger was not written to switch between two settings... just to change once.

    Does that code seem like Greek to you or does it make sense?

    Tip: use
    Code:
    // Your code here.
    brackets to preserve layout and readability.

    Comment


      #3
      most of it makes sense to me, I think it would help me understanding of Ut editor better if I was able to look at this class's parent.
      I can use this trigger to change the gravity up as many times as I want, just never down. Which kinda of defeats the point and I dont see a part of the code that would not allow me to do that,
      thanks for your input.

      Comment


        #4
        UnCodeX for all your source code browsing.

        Comment

        Working...
        X