Announcement

Collapse
No announcement yet.

Looking for a video tutorial on vehicles

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

  • Originally posted by meowcatbuf View Post
    Would you mind posting a couple of screenshots of the interior of the converted Mammoth vehicle (wire frame or smooth shaded would work too)? I'm trying to get some ideas of what to put on the inside of a similar vehicle (one that will be easier to make collision boxes for) that I'd like to make and I was trying to get an idea for the scale of the vehicle and what the interior looked like. Thanks!
















    I hope that is enough, let me know if you need more.
    Attached Files

    Comment


    • Thank you Mad Maxx, those are perfect! And thank you for including the picture of the other vehicle around it for scale too. Golly that is a big vehicle!

      Comment


      • Originally posted by meowcatbuf View Post
        Thank you Mad Maxx, those are perfect! And thank you for including the picture of the other vehicle around it for scale too. Golly that is a big vehicle!
        No problem at all. I am glad I can finely give back for all the help you have given me. If ever there is any thing elts I can do just let me know.

        on another note:
        Thanks again meowcatbuf, you advice payed off, (as usual) everything worked out great.
        The mech moves/travles well through out the map (anywhere I go).
        The mech now is above ground before I enter the vehicle.
        The mech legs now collides with map objects as well as bots.





        Code:
        //-----------------------------------------------------------
        //
        //-----------------------------------------------------------
        class BF2142_Chassis extends ONSHoverCraft;
        
        #exec OBJ LOAD FILE=..\Animations\MegaForce_A.ukx
        #exec OBJ LOAD FILE=..\textures\MegaForceTX.utx
        
        var()   float   MaxPitchSpeed;
        
        var()   float   JumpDuration;
        var()    float    JumpForceMag;
        var     float   JumpCountdown;
        var     float    JumpDelay, LastJumpTime;
        
        var()   float   DuckDuration;
        var()   float   DuckForceMag;
        var     float   DuckCountdown;
        
        var()    array<vector>                    BikeDustOffset;
        var()    float                            BikeDustTraceDistance;
        
        var()   sound                           JumpSound;
        var()   sound                           DuckSound;
        
        // Force Feedback
        var()    string                            JumpForce;
        
        var        array<ONSHoverBikeHoverDust>    BikeDust;
        var        array<vector>                    BikeDustLastNormal;
        
        var        bool                            DoBikeJump;
        var        bool                            OldDoBikeJump;
        
        var        bool                            DoBikeDuck;
        var        bool                            OldDoBikeDuck;
        var     bool                            bHoldingDuck;
        
        replication
        {
            reliable if (bNetDirty && Role == ROLE_Authority)
                DoBikeJump;
        }
        
        function Pawn CheckForHeadShot(Vector loc, Vector ray, float AdditionalScale)
        {
            local vector X, Y, Z, newray;
        
            GetAxes(Rotation,X,Y,Z);
        
            if (Driver != None)
            {
                // Remove the Z component of the ray
                newray = ray;
                newray.Z = 0;
                if (abs(newray dot X) < 0.7 && Driver.IsHeadShot(loc, ray, AdditionalScale))
                    return Driver;
            }
        
            return None;
        }
        
        simulated function Destroyed()
        {
            local int i;
        
            if (Level.NetMode != NM_DedicatedServer)
            {
                for (i = 0; i < BikeDust.Length; i++)
                    BikeDust[i].Destroy();
        
                BikeDust.Length = 0;
            }
        
            Super.Destroyed();
        }
        
        simulated function DestroyAppearance()
        {
            local int i;
        
            if (Level.NetMode != NM_DedicatedServer)
            {
                for (i = 0; i < BikeDust.Length; i++)
                    BikeDust[i].Destroy();
        
                BikeDust.Length = 0;
            }
        
            Super.DestroyAppearance();
        }
        
        function bool Dodge(eDoubleClickDir DoubleClickMove)
        {
            Rise = 1;
            return true;
        }
        
        function ChooseFireAt(Actor A)
        {
            if (Pawn(A) != None && Vehicle(A) == None && VSize(A.Location - Location) < 1500 && Controller.LineOfSightTo(A))
            {
                if (!bWeaponIsAltFiring)
                    AltFire(0);
            }
            else if (bWeaponIsAltFiring)
                VehicleCeaseFire(true);
        
            Fire(0);
        }
        
        simulated event DrivingStatusChanged()
        {
            local int i;
        
            Super.DrivingStatusChanged();
        
            if (bDriving && Level.NetMode != NM_DedicatedServer && BikeDust.Length == 0 && !bDropDetail)
            {
                BikeDust.Length = BikeDustOffset.Length;
                BikeDustLastNormal.Length = BikeDustOffset.Length;
        
                for(i=0; i<BikeDustOffset.Length; i++)
                    if (BikeDust[i] == None)
                    {
                        BikeDust[i] = spawn( class'ONSHoverBikeHoverDust', self,, Location + (BikeDustOffset[i] >> Rotation) );
                        BikeDust[i].SetDustColor( Level.DustColor );
                        BikeDustLastNormal[i] = vect(0,0,1);
                    }
            }
            else
            {
                if (Level.NetMode != NM_DedicatedServer)
                {
                    for(i=0; i<BikeDust.Length; i++)
                        BikeDust[i].Destroy();
        
                    BikeDust.Length = 0;
                }
                JumpCountDown = 0.0;
            }
        }
        
        simulated function Tick(float DeltaTime)
        {
            local float EnginePitch, HitDist;
            local int i;
            local vector TraceStart, TraceEnd, HitLocation, HitNormal;
            local actor HitActor;
            local Emitter JumpEffect;
        
            Super.Tick(DeltaTime);
        
            EnginePitch = 64.0 + VSize(Velocity)/MaxPitchSpeed * 64.0;
            SoundPitch = FClamp(EnginePitch, 64, 128);
        
            JumpCountdown -= DeltaTime;
        
            CheckJumpDuck();
        
            if(DoBikeJump != OldDoBikeJump)
            {
                JumpCountdown = JumpDuration;
                OldDoBikeJump = DoBikeJump;
                if (Controller != Level.GetLocalPlayerController())
                {
                    JumpEffect = Spawn(class'ONSHoverBikeJumpEffect');
                    JumpEffect.SetBase(Self);
                    ClientPlayForceFeedback(JumpForce);
                }
            }
        
            if(Level.NetMode != NM_DedicatedServer && !bDropDetail)
            {
                for(i=0; i<BikeDust.Length; i++)
                {
                    BikeDust[i].bDustActive = false;
        
                    TraceStart = Location + (BikeDustOffset[i] >> Rotation);
                    TraceEnd = TraceStart - ( BikeDustTraceDistance * vect(0,0,1) );
        
                    HitActor = Trace(HitLocation, HitNormal, TraceEnd, TraceStart, True);
        
                    if(HitActor == None)
                    {
                        BikeDust[i].UpdateHoverDust(false, 0);
                    }
                    else
                    {
                        HitDist = VSize(HitLocation - TraceStart);
        
                        BikeDust[i].SetLocation( HitLocation + 10*HitNormal);
        
                        BikeDustLastNormal[i] = Normal( 3*BikeDustLastNormal[i] + HitNormal );
                        BikeDust[i].SetRotation( Rotator(BikeDustLastNormal[i]) );
        
                        BikeDust[i].UpdateHoverDust(true, HitDist/BikeDustTraceDistance);
        
                        // If dust is just turning on, set OldLocation to current Location to avoid spawn interpolation.
                        if(!BikeDust[i].bDustActive)
                            BikeDust[i].OldLocation = BikeDust[i].Location;
        
                        BikeDust[i].bDustActive = true;
                    }
                }
            }
        }
        
        function VehicleCeaseFire(bool bWasAltFire)
        {
            Super.VehicleCeaseFire(bWasAltFire);
        
            if (bWasAltFire)
                bHoldingDuck = False;
        }
        
        simulated function float ChargeBar()
        {
            // Clamp to 0.999 so charge bar doesn't blink when maxed
            if (Level.TimeSeconds - JumpDelay < LastJumpTime)
                return (FMin((Level.TimeSeconds - LastJumpTime) / JumpDelay, 0.999));
            else
                return 0.999;
        }
        
        simulated function CheckJumpDuck()
        {
            local KarmaParams KP;
            local Emitter JumpEffect, DuckEffect;
            local bool bOnGround;
            local int i;
        
            KP = KarmaParams(KParams);
        
            // Can only start a jump when in contact with the ground.
            bOnGround = false;
            for(i=0; i<KP.Repulsors.Length; i++)
            {
                if( KP.Repulsors[i] != None && KP.Repulsors[i].bRepulsorInContact )
                    bOnGround = true;
            }
        
            // If we are on the ground, and press Rise, and we not currently in the middle of a jump, start a new one.
            if (JumpCountdown <= 0.0 && Rise > 0 && bOnGround && !bHoldingDuck && Level.TimeSeconds - JumpDelay >= LastJumpTime)
            {
                PlaySound(JumpSound,,1.0);
        
                if (Role == ROLE_Authority)
                   DoBikeJump = !DoBikeJump;
        
                if(Level.NetMode != NM_DedicatedServer)
                {
                    JumpEffect = Spawn(class'ONSHoverBikeJumpEffect');
                    JumpEffect.SetBase(Self);
                    ClientPlayForceFeedback(JumpForce);
                }
        
                if ( AIController(Controller) != None )
                    Rise = 0;
        
                LastJumpTime = Level.TimeSeconds;
            }
            else if (DuckCountdown <= 0.0 && (Rise < 0 || bWeaponIsAltFiring))
            {
                if (!bHoldingDuck)
                {
                    bHoldingDuck = True;
        
                    PlaySound(DuckSound,,1.0);
        
                    DuckEffect = Spawn(class'ONSHoverBikeDuckEffect');
                    DuckEffect.SetBase(Self);
        
                    if ( AIController(Controller) != None )
                        Rise = 0;
        
                    JumpCountdown = 0.0; // Stops any jumping that was going on.
                }
            }
            else
               bHoldingDuck = False;
        }
        
        simulated function KApplyForce(out vector Force, out vector Torque)
        {
            Super.KApplyForce(Force, Torque);
        
            if (bDriving && JumpCountdown > 0.0)
            {
                Force += vect(0,0,1) * JumpForceMag;
            }
        
            if (bDriving && bHoldingDuck)
            {
                Force += vect(0,0,-1) * DuckForceMag;
            }
        }
        
        static function StaticPrecache(LevelInfo L)
        {
            Super.StaticPrecache(L);
        
            L.AddPrecacheStaticMesh(StaticMesh'ONSDeadVehicles-SM.HoverExploded.HoverWing');
            L.AddPrecacheStaticMesh(StaticMesh'ONSDeadVehicles-SM.HoverExploded.HoverChair');
            L.AddPrecacheStaticMesh(StaticMesh'AW-2004Particles.Debris.Veh_Debris2');
            L.AddPrecacheStaticMesh(StaticMesh'AW-2004Particles.Debris.Veh_Debris1');
            L.AddPrecacheStaticMesh(StaticMesh'ONSWeapons-SM.PC_MantaJumpBlast');
        
            L.AddPrecacheMaterial(Material'ExplosionTex.Framed.exp2_frames');
            L.AddPrecacheMaterial(Material'ExplosionTex.Framed.exp1_frames');
            L.AddPrecacheMaterial(Material'ExplosionTex.Framed.we1_frames');
            L.AddPrecacheMaterial(Material'AW-2004Particles.Fire.MuchSmoke1');
            L.AddPrecacheMaterial(Material'AW-2004Particles.Fire.NapalmSpot');
            L.AddPrecacheMaterial(Material'EpicParticles.Fire.SprayFire1');
            L.AddPrecacheMaterial(Material'WeaponSkins.Skins.RocketTex0');
            L.AddPrecacheMaterial(Material'AW-2004Particles.Energy.JumpDuck');
            L.AddPrecacheMaterial(Material'VMVehicles-TX.HoverBikeGroup.hovercraftFANSblurTEX');
            L.AddPrecacheMaterial(Material'VMVehicles-TX.HoverBikeGroup.hoverCraftRED');
            L.AddPrecacheMaterial(Material'VMVehicles-TX.HoverBikeGroup.hoverCraftBLUE');
            L.AddPrecacheMaterial(Material'VMVehicles-TX.HoverBikeGroup.NewHoverCraftNOcolor');
            L.AddPrecacheMaterial(Material'AW-2004Particles.Energy.AirBlast');
            L.AddPrecacheMaterial(Material'AW-2004Particles.Weapons.SmokePanels2');
            L.AddPrecacheMaterial(Material'Engine.GRADIENT_Fade');
        
        }
        
        simulated function UpdatePrecacheStaticMeshes()
        {
            Level.AddPrecacheStaticMesh(StaticMesh'ONSDeadVehicles-SM.HoverExploded.HoverWing');
            Level.AddPrecacheStaticMesh(StaticMesh'ONSDeadVehicles-SM.HoverExploded.HoverChair');
            Level.AddPrecacheStaticMesh(StaticMesh'AW-2004Particles.Debris.Veh_Debris2');
            Level.AddPrecacheStaticMesh(StaticMesh'AW-2004Particles.Debris.Veh_Debris1');
            Level.AddPrecacheStaticMesh(StaticMesh'ONSWeapons-SM.PC_MantaJumpBlast');
            Level.AddPrecacheMaterial(Material'VMVehicles-TX.HoverBikeGroup.hovercraftFANSblurTEX');
        
            Super.UpdatePrecacheStaticMeshes();
        }
        
        simulated function UpdatePrecacheMaterials()
        {
            Level.AddPrecacheMaterial(Material'ExplosionTex.Framed.exp2_frames');
            Level.AddPrecacheMaterial(Material'ExplosionTex.Framed.exp1_frames');
            Level.AddPrecacheMaterial(Material'ExplosionTex.Framed.we1_frames');
            Level.AddPrecacheMaterial(Material'AW-2004Particles.Fire.MuchSmoke1');
            Level.AddPrecacheMaterial(Material'AW-2004Particles.Fire.NapalmSpot');
            Level.AddPrecacheMaterial(Material'EpicParticles.Fire.SprayFire1');
            Level.AddPrecacheMaterial(Material'WeaponSkins.Skins.RocketTex0');
            Level.AddPrecacheMaterial(Material'AW-2004Particles.Energy.JumpDuck');
            Level.AddPrecacheMaterial(Material'VMVehicles-TX.HoverBikeGroup.hoverCraftRED');
            Level.AddPrecacheMaterial(Material'VMVehicles-TX.HoverBikeGroup.hoverCraftBLUE');
            Level.AddPrecacheMaterial(Material'VMVehicles-TX.HoverBikeGroup.NewHoverCraftNOcolor');
            Level.AddPrecacheMaterial(Material'AW-2004Particles.Energy.AirBlast');
            Level.AddPrecacheMaterial(Material'AW-2004Particles.Weapons.SmokePanels2');
            Level.AddPrecacheMaterial(Material'Engine.GRADIENT_Fade');
        
            Super.UpdatePrecacheMaterials();
        }
        
        defaultproperties
        {
             MaxPitchSpeed=1000.000000
             JumpDuration=0.220000
             JumpForceMag=100.000000
             JumpDelay=3.000000
             DuckForceMag=150.000000
             JumpSound=ONSVehicleSounds-S.HoverBike.HoverBikeJump05
             DuckSound=ONSVehicleSounds-S.HoverBike.HoverBikeTurbo01
             JumpForce="HoverBikeJump"
             ThrusterOffsets(0)=(X=95.000000,Z=200.000000)
             HoverSoftness=0.220000
             HoverPenScale=1.000000
             HoverCheckDist=600.000000
             UprightStiffness=500.000000
             UprightDamping=500.000000
             MaxThrustForce=2.000000
             LongDamping=0.020000
             MaxStrafeForce=1.000000
             LatDamping=0.100000
             TurnTorqueFactor=1000.000000
             TurnTorqueMax=125.000000
             TurnDamping=40.000000
             MaxYawRate=1.500000
             PitchTorqueFactor=200.000000
             PitchTorqueMax=9.000000
             PitchDamping=20.000000
             RollTorqueTurnFactor=450.000000
             RollTorqueStrafeFactor=200.000000
             RollTorqueMax=1.500000
             RollDamping=3.000000
             StopThreshold=50.000000
        
             DriverWeapons(0)=(WeaponClass=Class'MegaForce.BF2142_Main_Turret',WeaponBone="Main_Turret_Base")
             PassengerWeapons(0)=(WeaponPawnClass=Class'MegaForce.BF2142_Gun_TurretPawn',WeaponBone="Gun_Turret_Base")
        
             bHasAltFire=False
             IdleSound=ONSVehicleSounds-S.HoverBike.HoverBikeEng02
             StartUpSound=ONSVehicleSounds-S.HoverBike.HoverBikeStart01
             ShutDownSound=ONSVehicleSounds-S.HoverBike.HoverBikeStop01
             StartUpForce="HoverBikeStartUp"
             ShutDownForce="HoverBikeShutDown""
             DestroyedVehicleMesh=ONSDeadVehicles-SM.HoverBikeDead
             DestructionEffectClass=Onslaught.ONSSmallVehicleExplosionEffect
             DisintegrationEffectClass=Onslaught.ONSVehDeathHoverBike
             DestructionLinearMomentum=(Min=62000.000000,Max=100000.000000)
             DestructionAngularMomentum=(Min=25.000000,Max=75.000000)
             DamagedEffectScale=0.600000
             DamagedEffectOffset=(X=50.000000,Y=-25.000000,Z=10.000000)
             ImpactDamageMult=0.000100
             HeadlightCoronaOffset(0)=(X=73.000000,Y=10.000000,Z=14.000000)
             HeadlightCoronaOffset(1)=(X=73.000000,Y=-10.000000,Z=14.000000)
             HeadlightCoronaMaterial=Texture'EpicParticles.Flares.FlashFlare1'
             HeadlightCoronaMaxSize=60.000000
             bDrawDriverInTP=False
             bTurnInPlace=True
             bShowDamageOverlay=True
             bScriptedRise=True
             bShowChargingBar=True
             bDriverHoldsFlag=True
             bCanCarryFlag=True
             DrivePos=(X=-50.000000,Z=48.000000)
             ExitPositions(0)=(Y=300.000000,Z=100.000000)
             ExitPositions(1)=(Y=-300.000000,Z=100.000000)
             ExitPositions(2)=(X=350.000000,Z=100.000000)
             ExitPositions(3)=(X=-350.000000,Z=100.000000)
             ExitPositions(4)=(X=-350.000000,Z=-100.000000)
             ExitPositions(5)=(X=350.000000,Z=-100.000000)
             ExitPositions(6)=(Y=300.000000,Z=-100.000000)
             ExitPositions(7)=(Y=-300.000000,Z=-100.000000)
             EntryRadius=500.000000
             FPCamPos=(Z=50.000000)
             TPCamDistance=300.000000
             TPCamLookat=(X=0.000000,Z=0.000000)
             TPCamWorldOffset=(Z=75.000000)
             VehiclePositionString="in an BF2142 Mech"
             VehicleNameString="BF2142 Mech"
             RanOverDamageType=Onslaught.DamTypeHoverBikeHeadshot
             CrushedDamageType=Onslaught.DamTypeHoverBikePancake
             ObjectiveGetOutDist=750.000000
             FlagBone="HoverCraft"
             FlagOffset=(Z=45.000000)
             FlagRotation=(Yaw=32768)
             HornSounds(0)=ONSVehicleSounds-S.Horns.Horn02
             HornSounds(1)=ONSVehicleSounds-S.Horns.La_Cucharacha_Horn
             bCanStrafe=True
             MeleeRange=-100.000000
             GroundSpeed=700.000000
             HealthMax=400.000000
             Health=400
             Mesh=SkeletalMesh'MegaForce_A.BF2142_Mech'
             SoundRadius=900.000000
             Begin Object Class=KarmaParamsRBFull Name=KParams0
                 KInertiaTensor(0)=1.300000
                 KLinearDamping=0.150000
                 KAngularDamping=200.000000
                 KStartEnabled=True
                 bHighDetailOnly=False
                 bClientOnly=False
                 bKDoubleTickRate=True
                 bKStayUpright=True
                 bKAllowRotate=True
                 bDestroyOnWorldPenetrate=True
                 bDoSafetime=True
                 KFriction=0.500000
                 KImpactThreshold=700.000000
             End Object
             KParams=KarmaParamsRBFull'MegaForce.BF2142_Chassis.KParams0'
        
        }
        So.. are we ready to link animations to mech movement in code or is there more that needs to be done?
        Attached Files

        Comment


        • Hi Maxx,
          Yeah, should be ready to link the animations now.

          In this case I think there is some pretty simple code that might work. The 'pawn' class (which is the parent class of vehicles) has a couple of variables that can be used to store the animation names. The 'MovementAnims' array holds 4 names for the animations that the pawns should play when moving forward, back, left and right. There is also the 'TurnLeftAnim', 'TurnRightAnim' and 'IdleRestAnim'. These can be filled in down in your default properties like this, with the animation name from the BF2142 mech skeletal animation set that would look best:
          Code:
              // change the RunF/RunB/RunL/RunR/TurnR/TurnL/Idle_Rest to the names of the BF2142 mech animation would look best
              MovementAnims(0)=RunF
              MovementAnims(1)=RunB
              MovementAnims(2)=RunL
              MovementAnims(3)=RunR
              TurnRightAnim=TurnR
              TurnLeftAnim=TurnL
              IdleRestAnim=Idle_Rest
          Now the xPawn class (the pawn class of your player that actually runs around in game) has some native (C++) code that actually play the appropriate animations based on the pawn's Physics state (walking, falling, flying, swimming etc.), ground speed, and whether the player is pressing crouch or walk. I converted that native code (which was included in the UT2004 source code for reference) into UScript code about 10 years ago (unfortunately UnrealWiki is down right now but I'll kink it later), so all we have to do is use portions of that in this case.

          I think for starters all you'll really need to do is have the Mech play the an idle/still animation when not moving (or falling), a turning animation when turning in place, or a moving animation. So here is a sample function that might work (this is very simplified, and could be made "nicer" with added code, but should get you started...), note that this is completely untested:

          Code:
          /* simply add this function call to your 'Tick' function right after CheckJumpDuck(); by adding this line
          
          UpdateMechAnim(DeltaTime);
          
          */
          // Then paste this function code block in your code after the 'KApplyForce' 
          // function code block and before the 'StaticPrecache' function code block 
          // (you can actually paste the new function after any of the function code
          // blocks as long as it is after all of the class variables have been declared
          // at the top, and before you begin listing the default properties.
          
          simulated function UpdateMechAnim(float DeltaTime)
          {
              local int NewAnimDirection;
              local KRigidBodyState BodyState;
              local float  TurnZAmount;
          
               // if we are on a server, don't bother playing the animations....  though you might want to for collision purposes even if they don't  completely sync up on the clients and server...
              if ( Level.NetMode == NM_DedicatedServer )
                  return;
              // Don't bother running the animations if this particular mech has not been rendered for over a second on this computer
              if (Level.TimeSeconds - LastRenderTime > 1.0){
                  return;
              }
              // Now start checking for whether the player is moving, standing still, or turning.
              //  The check for 80 may sound like a lot, but for a vehicle, 80 UU/seconds is not very fast at all
              // so we are basically standing still, or only moving very very slowly, so don't animate the legs 
              // as walking
              
              if(VSize(Velocity) < 80)
              {
                    KGetRigidBodyState(BodyState);
                     TurnZAmount = BodyState.AngVel.Z; // how much we are turning around the  Z-Axis, I do not know what unit this is in: radians-per-second,  degrees-per-second, rotations-per-second, URots-per-second it could eb  any of these.
                    if(Abs(TurnZAmount) > 40) // NOTE!!!!: you  will probably have to change the '40' to some other value since I don't  know what the typical magnitude of the AngularVelocity (AngVel) would  be expected to see...
                    {
                        if(TurnZAmount  > 0) LoopAnim(TurnRightAnim, 1.0, 0.1f, 0); // you might need to swap  the '>' operator for '<' if the animations are turning the wrong  direction.
                        else LoopAnim(TurnLeftAnim, 1.0, 0.1f, 0);
                    }
                    else // we're not turning, so we must just be standing in place...
                        LoopAnim(IdleRestAnim, 1.0, 0.1f, 0);
              }
              // we must be moving then, so first lets check to see if we are falling
              // and if we are not falling then, we're probably running around
              else
              {
                   VDirectionNormal = Normal(Velocity); // turn the velocity vector into a  'Unit Vector' (length == 1.0) and see if it mostly points down
                  if(VDirectionNormal.Z < -0.8) // we are mostly falling!
                  {
                        LoopAnim(IdleRestAnim, 1.0, 0.1f, 0); // go ahead and play the IdleRestAnim while falling
                  } 
                  else
                  {
                         NewAnimDirection = Get4WayDirection(); // this native C++ function returns 0,1,2,  or 3 based on which direction the pawn is moving compared to their  facing direction
                        LoopAnim(MovementAnims[NewAnimDirection], 1.0, 0.1f, 0);
                  }
              }
          }
          Now, if the animations don't include "strafing" left and right animations, then you will end up having to also change the direction of the mesh just like the UT pawns do when the player is turning while standing still (watch your player in third person, you twist your pawn's body to the left and right about 45 degrees before they will start turning too). I have converted code for this too if its needed, but it get a bit more complex.
          Last edited by meowcatbuf; 03-26-2017, 08:35 PM.

          Comment


          • I got this error, but I think it is because of "Word Wrap" I swear, I am not going to use that &%@&# thing any more.
            So how do I fix the text to make it right?

            error
            Code:
            UCC.log
            
            Log: Compiling BF2142_Chassis
            Error: C:\UT2004-Mods\MegaForce\Classes\BF2142_Chassis.uc(354) : Error, 'VDirectionNormal': Bad command or expression
            Log: Compile aborted due to errors.
            Log: Failure - 1 error(s), 0 warning(s)
            Exit: Preparing to exit.



            BF2142_Chassis.uc
            Code:
            //-----------------------------------------------------------
            //
            //-----------------------------------------------------------
            class BF2142_Chassis extends ONSHoverCraft;
            
            #exec OBJ LOAD FILE=..\Animations\MegaForce_A.ukx
            #exec OBJ LOAD FILE=..\textures\MegaForceTX.utx
            
            var()   float   MaxPitchSpeed;
            
            var()   float   JumpDuration;
            var()    float    JumpForceMag;
            var     float   JumpCountdown;
            var     float    JumpDelay, LastJumpTime;
            
            var()   float   DuckDuration;
            var()   float   DuckForceMag;
            var     float   DuckCountdown;
            
            var()    array<vector>                    BikeDustOffset;
            var()    float                            BikeDustTraceDistance;
            
            var()   sound                           JumpSound;
            var()   sound                           DuckSound;
            
            // Force Feedback
            var()    string                            JumpForce;
            
            var        array<ONSHoverBikeHoverDust>    BikeDust;
            var        array<vector>                    BikeDustLastNormal;
            
            var        bool                            DoBikeJump;
            var        bool                            OldDoBikeJump;
            
            var        bool                            DoBikeDuck;
            var        bool                            OldDoBikeDuck;
            var     bool                            bHoldingDuck;
            
            replication
            {
                reliable if (bNetDirty && Role == ROLE_Authority)
                    DoBikeJump;
            }
            
            function Pawn CheckForHeadShot(Vector loc, Vector ray, float AdditionalScale)
            {
                local vector X, Y, Z, newray;
            
                GetAxes(Rotation,X,Y,Z);
            
                if (Driver != None)
                {
                    // Remove the Z component of the ray
                    newray = ray;
                    newray.Z = 0;
                    if (abs(newray dot X) < 0.7 && Driver.IsHeadShot(loc, ray, AdditionalScale))
                        return Driver;
                }
            
                return None;
            }
            
            simulated function Destroyed()
            {
                local int i;
            
                if (Level.NetMode != NM_DedicatedServer)
                {
                    for (i = 0; i < BikeDust.Length; i++)
                        BikeDust[i].Destroy();
            
                    BikeDust.Length = 0;
                }
            
                Super.Destroyed();
            }
            
            simulated function DestroyAppearance()
            {
                local int i;
            
                if (Level.NetMode != NM_DedicatedServer)
                {
                    for (i = 0; i < BikeDust.Length; i++)
                        BikeDust[i].Destroy();
            
                    BikeDust.Length = 0;
                }
            
                Super.DestroyAppearance();
            }
            
            function bool Dodge(eDoubleClickDir DoubleClickMove)
            {
                Rise = 1;
                return true;
            }
            
            function ChooseFireAt(Actor A)
            {
                if (Pawn(A) != None && Vehicle(A) == None && VSize(A.Location - Location) < 1500 && Controller.LineOfSightTo(A))
                {
                    if (!bWeaponIsAltFiring)
                        AltFire(0);
                }
                else if (bWeaponIsAltFiring)
                    VehicleCeaseFire(true);
            
                Fire(0);
            }
            
            simulated event DrivingStatusChanged()
            {
                local int i;
            
                Super.DrivingStatusChanged();
            
                if (bDriving && Level.NetMode != NM_DedicatedServer && BikeDust.Length == 0 && !bDropDetail)
                {
                    BikeDust.Length = BikeDustOffset.Length;
                    BikeDustLastNormal.Length = BikeDustOffset.Length;
            
                    for(i=0; i<BikeDustOffset.Length; i++)
                        if (BikeDust[i] == None)
                        {
                            BikeDust[i] = spawn( class'ONSHoverBikeHoverDust', self,, Location + (BikeDustOffset[i] >> Rotation) );
                            BikeDust[i].SetDustColor( Level.DustColor );
                            BikeDustLastNormal[i] = vect(0,0,1);
                        }
                }
                else
                {
                    if (Level.NetMode != NM_DedicatedServer)
                    {
                        for(i=0; i<BikeDust.Length; i++)
                            BikeDust[i].Destroy();
            
                        BikeDust.Length = 0;
                    }
                    JumpCountDown = 0.0;
                }
            }
            
            simulated function Tick(float DeltaTime)
            {
                local float EnginePitch, HitDist;
                local int i;
                local vector TraceStart, TraceEnd, HitLocation, HitNormal;
                local actor HitActor;
                local Emitter JumpEffect;
            
                Super.Tick(DeltaTime);
            
                EnginePitch = 64.0 + VSize(Velocity)/MaxPitchSpeed * 64.0;
                SoundPitch = FClamp(EnginePitch, 64, 128);
            
                JumpCountdown -= DeltaTime;
            
                CheckJumpDuck();
            
                if(DoBikeJump != OldDoBikeJump)
                {
                    JumpCountdown = JumpDuration;
                    OldDoBikeJump = DoBikeJump;
                    if (Controller != Level.GetLocalPlayerController())
                    {
                        JumpEffect = Spawn(class'ONSHoverBikeJumpEffect');
                        JumpEffect.SetBase(Self);
                        ClientPlayForceFeedback(JumpForce);
                    }
                }
            
                if(Level.NetMode != NM_DedicatedServer && !bDropDetail)
                {
                    for(i=0; i<BikeDust.Length; i++)
                    {
                        BikeDust[i].bDustActive = false;
            
                        TraceStart = Location + (BikeDustOffset[i] >> Rotation);
                        TraceEnd = TraceStart - ( BikeDustTraceDistance * vect(0,0,1) );
            
                        HitActor = Trace(HitLocation, HitNormal, TraceEnd, TraceStart, True);
            
                        if(HitActor == None)
                        {
                            BikeDust[i].UpdateHoverDust(false, 0);
                        }
                        else
                        {
                            HitDist = VSize(HitLocation - TraceStart);
            
                            BikeDust[i].SetLocation( HitLocation + 10*HitNormal);
            
                            BikeDustLastNormal[i] = Normal( 3*BikeDustLastNormal[i] + HitNormal );
                            BikeDust[i].SetRotation( Rotator(BikeDustLastNormal[i]) );
            
                            BikeDust[i].UpdateHoverDust(true, HitDist/BikeDustTraceDistance);
            
                            // If dust is just turning on, set OldLocation to current Location to avoid spawn interpolation.
                            if(!BikeDust[i].bDustActive)
                                BikeDust[i].OldLocation = BikeDust[i].Location;
            
                            BikeDust[i].bDustActive = true;
                        }
                    }
                }
            }
            
            ////Anim test part 2
            /* simply add this function call to your 'Tick' function right after CheckJumpDuck(); by adding this line
            
            UpdateMechAnim(DeltaTime);
            
            */
            ////
            
            function VehicleCeaseFire(bool bWasAltFire)
            {
                Super.VehicleCeaseFire(bWasAltFire);
            
                if (bWasAltFire)
                    bHoldingDuck = False;
            }
            
            simulated function float ChargeBar()
            {
                // Clamp to 0.999 so charge bar doesn't blink when maxed
                if (Level.TimeSeconds - JumpDelay < LastJumpTime)
                    return (FMin((Level.TimeSeconds - LastJumpTime) / JumpDelay, 0.999));
                else
                    return 0.999;
            }
            
            simulated function CheckJumpDuck()
            {
                local KarmaParams KP;
                local Emitter JumpEffect, DuckEffect;
                local bool bOnGround;
                local int i;
            
                KP = KarmaParams(KParams);
            
                // Can only start a jump when in contact with the ground.
                bOnGround = false;
                for(i=0; i<KP.Repulsors.Length; i++)
                {
                    if( KP.Repulsors[i] != None && KP.Repulsors[i].bRepulsorInContact )
                        bOnGround = true;
                }
            
                // If we are on the ground, and press Rise, and we not currently in the middle of a jump, start a new one.
                if (JumpCountdown <= 0.0 && Rise > 0 && bOnGround && !bHoldingDuck && Level.TimeSeconds - JumpDelay >= LastJumpTime)
                {
                    PlaySound(JumpSound,,1.0);
            
                    if (Role == ROLE_Authority)
                       DoBikeJump = !DoBikeJump;
            
                    if(Level.NetMode != NM_DedicatedServer)
                    {
                        JumpEffect = Spawn(class'ONSHoverBikeJumpEffect');
                        JumpEffect.SetBase(Self);
                        ClientPlayForceFeedback(JumpForce);
                    }
            
                    if ( AIController(Controller) != None )
                        Rise = 0;
            
                    LastJumpTime = Level.TimeSeconds;
                }
                else if (DuckCountdown <= 0.0 && (Rise < 0 || bWeaponIsAltFiring))
                {
                    if (!bHoldingDuck)
                    {
                        bHoldingDuck = True;
            
                        PlaySound(DuckSound,,1.0);
            
                        DuckEffect = Spawn(class'ONSHoverBikeDuckEffect');
                        DuckEffect.SetBase(Self);
            
                        if ( AIController(Controller) != None )
                            Rise = 0;
            
                        JumpCountdown = 0.0; // Stops any jumping that was going on.
                    }
                }
                else
                   bHoldingDuck = False;
            }
            
            simulated function KApplyForce(out vector Force, out vector Torque)
            {
                Super.KApplyForce(Force, Torque);
            
                if (bDriving && JumpCountdown > 0.0)
                {
                    Force += vect(0,0,1) * JumpForceMag;
                }
            
                if (bDriving && bHoldingDuck)
                {
                    Force += vect(0,0,-1) * DuckForceMag;
                }
            }
            
            ////Anim test part 3
            // Then paste this function code block in your code after the 'KApplyForce' 
            // function code block and before the 'StaticPrecache' function code block 
            // (you can actually paste the new function after any of the function code
            // blocks as long as it is after all of the class variables have been declared
            // at the top, and before you begin listing the default properties.
            
            simulated function UpdateMechAnim(float DeltaTime)
            {
                local int NewAnimDirection;
                local KRigidBodyState BodyState;
                local float  TurnZAmount;
            
                 // if we are on a server, don't bother playing the animations....
                 // though you might want to for collision purposes even if they don't completely sync up on the clients and server...
                if ( Level.NetMode == NM_DedicatedServer )
                    return;
                // Don't bother running the animations if this particular mech has 
                // not been rendered for over a second on this computer
                if (Level.TimeSeconds - LastRenderTime > 1.0){
                    return;
                }
                // Now start checking for whether the player is moving, standing still, or turning.
                //  The check for 80 may sound like a lot, but for a vehicle, 80 UU/seconds is not very fast at all
                // so we are basically standing still, or only moving very very slowly, so don't animate the legs 
                // as walking
                
                if(VSize(Velocity) < 80)
                {
                      KGetRigidBodyState(BodyState);
                       TurnZAmount = BodyState.AngVel.Z; // how much we are turning around the  Z-Axis, 
                 // I do not know what unit this is in: radians-per-second,  degrees-per-second, rotations-per-second, 
                 // URots-per-second it could eb  any of these.
                      if(Abs(TurnZAmount) > 40) // NOTE!!!!: you  will probably have to change the '40' to some other value 
                 // since I don't  know what the typical magnitude of the AngularVelocity (AngVel) would  be expected to see...
                      {
                          if(TurnZAmount  > 0) LoopAnim(TurnRightAnim, 1.0, 0.1f,
             0); // you might need to swap  the '>' operator for '<' if the animations are turning the wrong  direction.
                          else LoopAnim(TurnLeftAnim, 1.0, 0.1f, 0);
                      }
                      else // we're not turning, so we must just be standing in place...
                          LoopAnim(IdleRestAnim, 1.0, 0.1f, 0);
                }
                // we must be moving then, so first lets check to see if we are falling
                // and if we are not falling then, we're probably running around
                else
                {
                     VDirectionNormal = Normal(Velocity); // turn the velocity vector into a   'Unit Vector' (length == 1.0) 
                 // and see if it mostly points down
                    if(VDirectionNormal.Z < -0.8) // we are mostly falling!
                    {
                          LoopAnim(IdleRestAnim, 1.0, 0.1f, 0); // go ahead and play the IdleRestAnim while falling
                    } 
                    else
                    {
                           NewAnimDirection = Get4WayDirection(); // this native C++ function returns 0,1,2,  
                 // or 3 based on which direction the pawn is moving compared to their  facing direction
                          LoopAnim(MovementAnims[NewAnimDirection], 1.0, 0.1f, 0);
                    }
                }
            }
            ////
            
            static function StaticPrecache(LevelInfo L)
            {
                Super.StaticPrecache(L);
            
                L.AddPrecacheStaticMesh(StaticMesh'ONSDeadVehicles-SM.HoverExploded.HoverWing');
                L.AddPrecacheStaticMesh(StaticMesh'ONSDeadVehicles-SM.HoverExploded.HoverChair');
                L.AddPrecacheStaticMesh(StaticMesh'AW-2004Particles.Debris.Veh_Debris2');
                L.AddPrecacheStaticMesh(StaticMesh'AW-2004Particles.Debris.Veh_Debris1');
                L.AddPrecacheStaticMesh(StaticMesh'ONSWeapons-SM.PC_MantaJumpBlast');
            
                L.AddPrecacheMaterial(Material'ExplosionTex.Framed.exp2_frames');
                L.AddPrecacheMaterial(Material'ExplosionTex.Framed.exp1_frames');
                L.AddPrecacheMaterial(Material'ExplosionTex.Framed.we1_frames');
                L.AddPrecacheMaterial(Material'AW-2004Particles.Fire.MuchSmoke1');
                L.AddPrecacheMaterial(Material'AW-2004Particles.Fire.NapalmSpot');
                L.AddPrecacheMaterial(Material'EpicParticles.Fire.SprayFire1');
                L.AddPrecacheMaterial(Material'WeaponSkins.Skins.RocketTex0');
                L.AddPrecacheMaterial(Material'AW-2004Particles.Energy.JumpDuck');
                L.AddPrecacheMaterial(Material'VMVehicles-TX.HoverBikeGroup.hovercraftFANSblurTEX');
                L.AddPrecacheMaterial(Material'VMVehicles-TX.HoverBikeGroup.hoverCraftRED');
                L.AddPrecacheMaterial(Material'VMVehicles-TX.HoverBikeGroup.hoverCraftBLUE');
                L.AddPrecacheMaterial(Material'VMVehicles-TX.HoverBikeGroup.NewHoverCraftNOcolor');
                L.AddPrecacheMaterial(Material'AW-2004Particles.Energy.AirBlast');
                L.AddPrecacheMaterial(Material'AW-2004Particles.Weapons.SmokePanels2');
                L.AddPrecacheMaterial(Material'Engine.GRADIENT_Fade');
            
            }
            
            simulated function UpdatePrecacheStaticMeshes()
            {
                Level.AddPrecacheStaticMesh(StaticMesh'ONSDeadVehicles-SM.HoverExploded.HoverWing');
                Level.AddPrecacheStaticMesh(StaticMesh'ONSDeadVehicles-SM.HoverExploded.HoverChair');
                Level.AddPrecacheStaticMesh(StaticMesh'AW-2004Particles.Debris.Veh_Debris2');
                Level.AddPrecacheStaticMesh(StaticMesh'AW-2004Particles.Debris.Veh_Debris1');
                Level.AddPrecacheStaticMesh(StaticMesh'ONSWeapons-SM.PC_MantaJumpBlast');
                Level.AddPrecacheMaterial(Material'VMVehicles-TX.HoverBikeGroup.hovercraftFANSblurTEX');
            
                Super.UpdatePrecacheStaticMeshes();
            }
            
            simulated function UpdatePrecacheMaterials()
            {
                Level.AddPrecacheMaterial(Material'ExplosionTex.Framed.exp2_frames');
                Level.AddPrecacheMaterial(Material'ExplosionTex.Framed.exp1_frames');
                Level.AddPrecacheMaterial(Material'ExplosionTex.Framed.we1_frames');
                Level.AddPrecacheMaterial(Material'AW-2004Particles.Fire.MuchSmoke1');
                Level.AddPrecacheMaterial(Material'AW-2004Particles.Fire.NapalmSpot');
                Level.AddPrecacheMaterial(Material'EpicParticles.Fire.SprayFire1');
                Level.AddPrecacheMaterial(Material'WeaponSkins.Skins.RocketTex0');
                Level.AddPrecacheMaterial(Material'AW-2004Particles.Energy.JumpDuck');
                Level.AddPrecacheMaterial(Material'VMVehicles-TX.HoverBikeGroup.hoverCraftRED');
                Level.AddPrecacheMaterial(Material'VMVehicles-TX.HoverBikeGroup.hoverCraftBLUE');
                Level.AddPrecacheMaterial(Material'VMVehicles-TX.HoverBikeGroup.NewHoverCraftNOcolor');
                Level.AddPrecacheMaterial(Material'AW-2004Particles.Energy.AirBlast');
                Level.AddPrecacheMaterial(Material'AW-2004Particles.Weapons.SmokePanels2');
                Level.AddPrecacheMaterial(Material'Engine.GRADIENT_Fade');
            
                Super.UpdatePrecacheMaterials();
            }
            
            defaultproperties
            ////Anim test part 1
                // change the RunF/RunB/RunL/RunR/TurnR/TurnL/Idle_Rest to the names of the BF2142 mech animation would look best
                MovementAnims(0)=Walk
                MovementAnims(1)=WalkBack
                MovementAnims(2)=StepLeft
                MovementAnims(3)=StepRight
                TurnRightAnim=Turn
                TurnLeftAnim=Turn
                IdleRestAnim=Idle
            ////
            {
                 MaxPitchSpeed=1000.000000
                 JumpDuration=0.220000
                 JumpForceMag=100.000000
                 JumpDelay=3.000000
                 DuckForceMag=150.000000
                 JumpSound=ONSVehicleSounds-S.HoverBike.HoverBikeJump05
                 DuckSound=ONSVehicleSounds-S.HoverBike.HoverBikeTurbo01
                 JumpForce="HoverBikeJump"
                 ThrusterOffsets(0)=(X=95.000000,Z=200.000000)
                 HoverSoftness=0.220000
                 HoverPenScale=1.000000
                 HoverCheckDist=600.000000
                 UprightStiffness=500.000000
                 UprightDamping=500.000000
                 MaxThrustForce=2.000000
                 LongDamping=0.020000
                 MaxStrafeForce=1.000000
                 LatDamping=0.100000
                 TurnTorqueFactor=1000.000000
                 TurnTorqueMax=125.000000
                 TurnDamping=40.000000
                 MaxYawRate=1.500000
                 PitchTorqueFactor=200.000000
                 PitchTorqueMax=9.000000
                 PitchDamping=20.000000
                 RollTorqueTurnFactor=450.000000
                 RollTorqueStrafeFactor=200.000000
                 RollTorqueMax=1.500000
                 RollDamping=3.000000
                 StopThreshold=50.000000
            
                 DriverWeapons(0)=(None)
                 PassengerWeapons(0)=(None)
            
                 bHasAltFire=False
                 IdleSound=ONSVehicleSounds-S.HoverBike.HoverBikeEng02
                 StartUpSound=ONSVehicleSounds-S.HoverBike.HoverBikeStart01
                 ShutDownSound=ONSVehicleSounds-S.HoverBike.HoverBikeStop01
                 StartUpForce="HoverBikeStartUp"
                 ShutDownForce="HoverBikeShutDown""
                 DestroyedVehicleMesh=ONSDeadVehicles-SM.HoverBikeDead
                 DestructionEffectClass=Onslaught.ONSSmallVehicleExplosionEffect
                 DisintegrationEffectClass=Onslaught.ONSVehDeathHoverBike
                 DestructionLinearMomentum=(Min=62000.000000,Max=100000.000000)
                 DestructionAngularMomentum=(Min=25.000000,Max=75.000000)
                 DamagedEffectScale=0.600000
                 DamagedEffectOffset=(X=50.000000,Y=-25.000000,Z=10.000000)
                 ImpactDamageMult=0.000100
                 HeadlightCoronaOffset(0)=(X=73.000000,Y=10.000000,Z=14.000000)
                 HeadlightCoronaOffset(1)=(X=73.000000,Y=-10.000000,Z=14.000000)
                 HeadlightCoronaMaterial=Texture'EpicParticles.Flares.FlashFlare1'
                 HeadlightCoronaMaxSize=60.000000
                 bDrawDriverInTP=False
                 bTurnInPlace=True
                 bShowDamageOverlay=True
                 bScriptedRise=True
                 bShowChargingBar=True
                 bDriverHoldsFlag=True
                 bCanCarryFlag=True
                 DrivePos=(X=-50.000000,Z=75.000000)
                 ExitPositions(0)=(Y=300.000000,Z=100.000000)
                 ExitPositions(1)=(Y=-300.000000,Z=100.000000)
                 ExitPositions(2)=(X=350.000000,Z=100.000000)
                 ExitPositions(3)=(X=-350.000000,Z=100.000000)
                 ExitPositions(4)=(X=-350.000000,Z=-100.000000)
                 ExitPositions(5)=(X=350.000000,Z=-100.000000)
                 ExitPositions(6)=(Y=300.000000,Z=-100.000000)
                 ExitPositions(7)=(Y=-300.000000,Z=-100.000000)
                 EntryRadius=350.000000
                 FPCamPos=(X=100.000000,Z=500.000000)
                 TPCamDistance=500.000000
                 TPCamLookat=(X=100.000000,Z=50.000000)
                 TPCamWorldOffset=(Z=100.000000)
                 VehiclePositionString="in an BF2142 Mech"
                 VehicleNameString="BF2142 Mech"
                 RanOverDamageType=Onslaught.DamTypeHoverBikeHeadshot
                 CrushedDamageType=Onslaught.DamTypeHoverBikePancake
                 ObjectiveGetOutDist=750.000000
                 FlagBone="HoverCraft"
                 FlagOffset=(Z=45.000000)
                 FlagRotation=(Yaw=32768)
                 HornSounds(0)=ONSVehicleSounds-S.Horns.Horn02
                 HornSounds(1)=ONSVehicleSounds-S.Horns.La_Cucharacha_Horn
                 bCanStrafe=True
                 MeleeRange=-100.000000
                 GroundSpeed=700.000000
                 HealthMax=400.000000
                 Health=400
                 Mesh=SkeletalMesh'MegaForce_A.BF2142_Mech'
                 SoundRadius=900.000000
                 Begin Object Class=KarmaParamsRBFull Name=KParams0
                     KInertiaTensor(0)=1.300000
                     KLinearDamping=0.150000
                     KAngularDamping=200.000000
                     KStartEnabled=True
                     bHighDetailOnly=False
                     bClientOnly=False
                     bKDoubleTickRate=True
                     bKStayUpright=True
                     bKAllowRotate=True
                     bDestroyOnWorldPenetrate=True
                     bDoSafetime=True
                     KFriction=0.500000
                     KImpactThreshold=700.000000
                 End Object
                 KParams=KarmaParamsRBFull'MegaForce.BF2142_Chassis.KParams0'
            
            }

            Comment


            • Whoops! If you look at my code, 'VDirectionNormal' is a vector variable (the function 'Normal(vector MyVector)' returns a normalized vector), but I failed to declare it in the beginning of the function or above in the class variables. I've edited the code you posted with 'VDirectionNormal' declared as a local variable, and also made a few other corrections, see highlights in blue.

              and yes wordwrap should never be used if you writing your code in Notepad. I use the Unreal Development Environment (UDE), which was a version of WotGreal licensed by Epic for UT2k4, to do all my code editing since it has syntax highlighting.

              Code:
              //-----------------------------------------------------------
              //
              //-----------------------------------------------------------
              class BF2142_Chassis extends ONSHoverCraft;
              
              #exec OBJ LOAD FILE=..\Animations\MegaForce_A.ukx
              #exec OBJ LOAD FILE=..\textures\MegaForceTX.utx
              
              var()   float   MaxPitchSpeed;
              
              var()   float   JumpDuration;
              var()    float    JumpForceMag;
              var     float   JumpCountdown;
              var     float    JumpDelay, LastJumpTime;
              
              var()   float   DuckDuration;
              var()   float   DuckForceMag;
              var     float   DuckCountdown;
              
              var()    array<vector>                    BikeDustOffset;
              var()    float                            BikeDustTraceDistance;
              
              var()   sound                           JumpSound;
              var()   sound                           DuckSound;
              
              // Force Feedback
              var()    string                            JumpForce;
              
              var        array<ONSHoverBikeHoverDust>    BikeDust;
              var        array<vector>                    BikeDustLastNormal;
              
              var        bool                            DoBikeJump;
              var        bool                            OldDoBikeJump;
              
              var        bool                            DoBikeDuck;
              var        bool                            OldDoBikeDuck;
              var     bool                            bHoldingDuck;
              
              replication
              {
                  reliable if (bNetDirty && Role == ROLE_Authority)
                      DoBikeJump;
              }
              
              function Pawn CheckForHeadShot(Vector loc, Vector ray, float AdditionalScale)
              {
                  local vector X, Y, Z, newray;
              
                  GetAxes(Rotation,X,Y,Z);
              
                  if (Driver != None)
                  {
                      // Remove the Z component of the ray
                      newray = ray;
                      newray.Z = 0;
                      if (abs(newray dot X) < 0.7 && Driver.IsHeadShot(loc, ray, AdditionalScale))
                          return Driver;
                  }
              
                  return None;
              }
              
              simulated function Destroyed()
              {
                  local int i;
              
                  if (Level.NetMode != NM_DedicatedServer)
                  {
                      for (i = 0; i < BikeDust.Length; i++)
                          BikeDust[i].Destroy();
              
                      BikeDust.Length = 0;
                  }
              
                  Super.Destroyed();
              }
              
              simulated function DestroyAppearance()
              {
                  local int i;
              
                  if (Level.NetMode != NM_DedicatedServer)
                  {
                      for (i = 0; i < BikeDust.Length; i++)
                          BikeDust[i].Destroy();
              
                      BikeDust.Length = 0;
                  }
              
                  Super.DestroyAppearance();
              }
              
              function bool Dodge(eDoubleClickDir DoubleClickMove)
              {
                  Rise = 1;
                  return true;
              }
              
              function ChooseFireAt(Actor A)
              {
                  if (Pawn(A) != None && Vehicle(A) == None && VSize(A.Location - Location) < 1500 && Controller.LineOfSightTo(A))
                  {
                      if (!bWeaponIsAltFiring)
                          AltFire(0);
                  }
                  else if (bWeaponIsAltFiring)
                      VehicleCeaseFire(true);
              
                  Fire(0);
              }
              
              simulated event DrivingStatusChanged()
              {
                  local int i;
              
                  Super.DrivingStatusChanged();
              
                  if (bDriving && Level.NetMode != NM_DedicatedServer && BikeDust.Length == 0 && !bDropDetail)
                  {
                      BikeDust.Length = BikeDustOffset.Length;
                      BikeDustLastNormal.Length = BikeDustOffset.Length;
              
                      for(i=0; i<BikeDustOffset.Length; i++)
                          if (BikeDust[i] == None)
                          {
                              BikeDust[i] = spawn( class'ONSHoverBikeHoverDust', self,, Location + (BikeDustOffset[i] >> Rotation) );
                              BikeDust[i].SetDustColor( Level.DustColor );
                              BikeDustLastNormal[i] = vect(0,0,1);
                          }
                  }
                  else
                  {
                      if (Level.NetMode != NM_DedicatedServer)
                      {
                          for(i=0; i<BikeDust.Length; i++)
                              BikeDust[i].Destroy();
              
                          BikeDust.Length = 0;
                      }
                      JumpCountDown = 0.0;
                  }
              }
              
              simulated function Tick(float DeltaTime)
              {
                  local float EnginePitch, HitDist;
                  local int i;
                  local vector TraceStart, TraceEnd, HitLocation, HitNormal;
                  local actor HitActor;
                  local Emitter JumpEffect;
              
                  Super.Tick(DeltaTime);
              
                  EnginePitch = 64.0 + VSize(Velocity)/MaxPitchSpeed * 64.0;
                  SoundPitch = FClamp(EnginePitch, 64, 128);
              
                  JumpCountdown -= DeltaTime;
              
                  CheckJumpDuck();
              
                  UpdateMechAnim(DeltaTime);
              
                  if(DoBikeJump != OldDoBikeJump)
                  {
                      JumpCountdown = JumpDuration;
                      OldDoBikeJump = DoBikeJump;
                      if (Controller != Level.GetLocalPlayerController())
                      {
                          JumpEffect = Spawn(class'ONSHoverBikeJumpEffect');
                          JumpEffect.SetBase(Self);
                          ClientPlayForceFeedback(JumpForce);
                      }
                  }
              
                  if(Level.NetMode != NM_DedicatedServer && !bDropDetail)
                  {
                      for(i=0; i<BikeDust.Length; i++)
                      {
                          BikeDust[i].bDustActive = false;
              
                          TraceStart = Location + (BikeDustOffset[i] >> Rotation);
                          TraceEnd = TraceStart - ( BikeDustTraceDistance * vect(0,0,1) );
              
                          HitActor = Trace(HitLocation, HitNormal, TraceEnd, TraceStart, True);
              
                          if(HitActor == None)
                          {
                              BikeDust[i].UpdateHoverDust(false, 0);
                          }
                          else
                          {
                              HitDist = VSize(HitLocation - TraceStart);
              
                              BikeDust[i].SetLocation( HitLocation + 10*HitNormal);
              
                              BikeDustLastNormal[i] = Normal( 3*BikeDustLastNormal[i] + HitNormal );
                              BikeDust[i].SetRotation( Rotator(BikeDustLastNormal[i]) );
              
                              BikeDust[i].UpdateHoverDust(true, HitDist/BikeDustTraceDistance);
              
                              // If dust is just turning on, set OldLocation to current Location to avoid spawn interpolation.
                              if(!BikeDust[i].bDustActive)
                                  BikeDust[i].OldLocation = BikeDust[i].Location;
              
                              BikeDust[i].bDustActive = true;
                          }
                      }
                  }
              }
              
              ////Anim test part 2 // this call to the function is not inside the 'Tick' function code block, 
              // see edit above ;-) ^^^
              /* simply add this function call to your 'Tick' function right after CheckJumpDuck(); by adding this line
              
              UpdateMechAnim(DeltaTime); // this is actually inside a comment block because of the / and * and then * and / closing the comment block
              
              */
              ////
              
              function VehicleCeaseFire(bool bWasAltFire)
              {
                  Super.VehicleCeaseFire(bWasAltFire);
              
                  if (bWasAltFire)
                      bHoldingDuck = False;
              }
              
              simulated function float ChargeBar()
              {
                  // Clamp to 0.999 so charge bar doesn't blink when maxed
                  if (Level.TimeSeconds - JumpDelay < LastJumpTime)
                      return (FMin((Level.TimeSeconds - LastJumpTime) / JumpDelay, 0.999));
                  else
                      return 0.999;
              }
              
              simulated function CheckJumpDuck()
              {
                  local KarmaParams KP;
                  local Emitter JumpEffect, DuckEffect;
                  local bool bOnGround;
                  local int i;
              
                  KP = KarmaParams(KParams);
              
                  // Can only start a jump when in contact with the ground.
                  bOnGround = false;
                  for(i=0; i<KP.Repulsors.Length; i++)
                  {
                      if( KP.Repulsors[i] != None && KP.Repulsors[i].bRepulsorInContact )
                          bOnGround = true;
                  }
              
                  // If we are on the ground, and press Rise, and we not currently in the middle of a jump, start a new one.
                  if (JumpCountdown <= 0.0 && Rise > 0 && bOnGround && !bHoldingDuck && Level.TimeSeconds - JumpDelay >= LastJumpTime)
                  {
                      PlaySound(JumpSound,,1.0);
              
                      if (Role == ROLE_Authority)
                         DoBikeJump = !DoBikeJump;
              
                      if(Level.NetMode != NM_DedicatedServer)
                      {
                          JumpEffect = Spawn(class'ONSHoverBikeJumpEffect');
                          JumpEffect.SetBase(Self);
                          ClientPlayForceFeedback(JumpForce);
                      }
              
                      if ( AIController(Controller) != None )
                          Rise = 0;
              
                      LastJumpTime = Level.TimeSeconds;
                  }
                  else if (DuckCountdown <= 0.0 && (Rise < 0 || bWeaponIsAltFiring))
                  {
                      if (!bHoldingDuck)
                      {
                          bHoldingDuck = True;
              
                          PlaySound(DuckSound,,1.0);
              
                          DuckEffect = Spawn(class'ONSHoverBikeDuckEffect');
                          DuckEffect.SetBase(Self);
              
                          if ( AIController(Controller) != None )
                              Rise = 0;
              
                          JumpCountdown = 0.0; // Stops any jumping that was going on.
                      }
                  }
                  else
                     bHoldingDuck = False;
              }
              
              simulated function KApplyForce(out vector Force, out vector Torque)
              {
                  Super.KApplyForce(Force, Torque);
              
                  if (bDriving && JumpCountdown > 0.0)
                  {
                      Force += vect(0,0,1) * JumpForceMag;
                  }
              
                  if (bDriving && bHoldingDuck)
                  {
                      Force += vect(0,0,-1) * DuckForceMag;
                  }
              }
              
              ////Anim test part 3
              // Then paste this function code block in your code after the 'KApplyForce' 
              // function code block and before the 'StaticPrecache' function code block 
              // (you can actually paste the new function after any of the function code
              // blocks as long as it is after all of the class variables have been declared
              // at the top, and before you begin listing the default properties.
              
              simulated function UpdateMechAnim(float DeltaTime)
              {
                  local int NewAnimDirection;
                  local KRigidBodyState BodyState;
                  local float  TurnZAmount;
                  local vector VDirectionNormal;
              
                   // if we are on a server, don't bother playing the animations....
                   // though you might want to for collision purposes even if they don't completely sync up on the clients and server...
                  if ( Level.NetMode == NM_DedicatedServer )
                      return;
                  // Don't bother running the animations if this particular mech has 
                  // not been rendered for over a second on this computer
                  if (Level.TimeSeconds - LastRenderTime > 1.0){
                      return;
                  }
                  // Now start checking for whether the player is moving, standing still, or turning.
                  //  The check for 80 may sound like a lot, but for a vehicle, 80 UU/seconds is not very fast at all
                  // so we are basically standing still, or only moving very very slowly, so don't animate the legs 
                  // as walking
                  
                  if(VSize(Velocity) < 80)
                  {
                        KGetRigidBodyState(BodyState);
                         TurnZAmount = BodyState.AngVel.Z; // how much we are turning around the  Z-Axis, 
                   // I do not know what unit this is in: radians-per-second,  degrees-per-second, rotations-per-second, 
                   // URots-per-second it could eb  any of these.
                        if(Abs(TurnZAmount) > 40) // NOTE!!!!: you  will probably have to change the '40' to some other value 
                   // since I don't  know what the typical magnitude of the AngularVelocity (AngVel) would  be expected to see...
                        {
                            if(TurnZAmount  > 0) LoopAnim(TurnRightAnim, 1.0, 0.1f, 0); // you might need to swap  the '>' operator for '<' if the animations are turning the wrong  direction.
                            else LoopAnim(TurnLeftAnim, 1.0, 0.1f, 0);
                        }
                        else // we're not turning, so we must just be standing in place...
                            LoopAnim(IdleRestAnim, 1.0, 0.1f, 0);
                  }
                  // we must be moving then, so first lets check to see if we are falling
                  // and if we are not falling then, we're probably running around
                  else
                  {
                       VDirectionNormal = Normal(Velocity); // turn the velocity vector into a   'Unit Vector' (length == 1.0) 
                   // and see if it mostly points down
                      if(VDirectionNormal.Z < -0.8) // we are mostly falling!
                      {
                            LoopAnim(IdleRestAnim, 1.0, 0.1f, 0); // go ahead and play the IdleRestAnim while falling
                      } 
                      else
                      {
                             NewAnimDirection = Get4WayDirection(); // this native C++ function returns 0,1,2,  
                   // or 3 based on which direction the pawn is moving compared to their  facing direction
                            LoopAnim(MovementAnims[NewAnimDirection], 1.0, 0.1f, 0);
                      }
                  }
              }
              ////
              
              static function StaticPrecache(LevelInfo L)
              {
                  Super.StaticPrecache(L);
              
                  L.AddPrecacheStaticMesh(StaticMesh'ONSDeadVehicles-SM.HoverExploded.HoverWing');
                  L.AddPrecacheStaticMesh(StaticMesh'ONSDeadVehicles-SM.HoverExploded.HoverChair');
                  L.AddPrecacheStaticMesh(StaticMesh'AW-2004Particles.Debris.Veh_Debris2');
                  L.AddPrecacheStaticMesh(StaticMesh'AW-2004Particles.Debris.Veh_Debris1');
                  L.AddPrecacheStaticMesh(StaticMesh'ONSWeapons-SM.PC_MantaJumpBlast');
              
                  L.AddPrecacheMaterial(Material'ExplosionTex.Framed.exp2_frames');
                  L.AddPrecacheMaterial(Material'ExplosionTex.Framed.exp1_frames');
                  L.AddPrecacheMaterial(Material'ExplosionTex.Framed.we1_frames');
                  L.AddPrecacheMaterial(Material'AW-2004Particles.Fire.MuchSmoke1');
                  L.AddPrecacheMaterial(Material'AW-2004Particles.Fire.NapalmSpot');
                  L.AddPrecacheMaterial(Material'EpicParticles.Fire.SprayFire1');
                  L.AddPrecacheMaterial(Material'WeaponSkins.Skins.RocketTex0');
                  L.AddPrecacheMaterial(Material'AW-2004Particles.Energy.JumpDuck');
                  L.AddPrecacheMaterial(Material'VMVehicles-TX.HoverBikeGroup.hovercraftFANSblurTEX');
                  L.AddPrecacheMaterial(Material'VMVehicles-TX.HoverBikeGroup.hoverCraftRED');
                  L.AddPrecacheMaterial(Material'VMVehicles-TX.HoverBikeGroup.hoverCraftBLUE');
                  L.AddPrecacheMaterial(Material'VMVehicles-TX.HoverBikeGroup.NewHoverCraftNOcolor');
                  L.AddPrecacheMaterial(Material'AW-2004Particles.Energy.AirBlast');
                  L.AddPrecacheMaterial(Material'AW-2004Particles.Weapons.SmokePanels2');
                  L.AddPrecacheMaterial(Material'Engine.GRADIENT_Fade');
              
              }
              
              simulated function UpdatePrecacheStaticMeshes()
              {
                  Level.AddPrecacheStaticMesh(StaticMesh'ONSDeadVehicles-SM.HoverExploded.HoverWing');
                  Level.AddPrecacheStaticMesh(StaticMesh'ONSDeadVehicles-SM.HoverExploded.HoverChair');
                  Level.AddPrecacheStaticMesh(StaticMesh'AW-2004Particles.Debris.Veh_Debris2');
                  Level.AddPrecacheStaticMesh(StaticMesh'AW-2004Particles.Debris.Veh_Debris1');
                  Level.AddPrecacheStaticMesh(StaticMesh'ONSWeapons-SM.PC_MantaJumpBlast');
                  Level.AddPrecacheMaterial(Material'VMVehicles-TX.HoverBikeGroup.hovercraftFANSblurTEX');
              
                  Super.UpdatePrecacheStaticMeshes();
              }
              
              simulated function UpdatePrecacheMaterials()
              {
                  Level.AddPrecacheMaterial(Material'ExplosionTex.Framed.exp2_frames');
                  Level.AddPrecacheMaterial(Material'ExplosionTex.Framed.exp1_frames');
                  Level.AddPrecacheMaterial(Material'ExplosionTex.Framed.we1_frames');
                  Level.AddPrecacheMaterial(Material'AW-2004Particles.Fire.MuchSmoke1');
                  Level.AddPrecacheMaterial(Material'AW-2004Particles.Fire.NapalmSpot');
                  Level.AddPrecacheMaterial(Material'EpicParticles.Fire.SprayFire1');
                  Level.AddPrecacheMaterial(Material'WeaponSkins.Skins.RocketTex0');
                  Level.AddPrecacheMaterial(Material'AW-2004Particles.Energy.JumpDuck');
                  Level.AddPrecacheMaterial(Material'VMVehicles-TX.HoverBikeGroup.hoverCraftRED');
                  Level.AddPrecacheMaterial(Material'VMVehicles-TX.HoverBikeGroup.hoverCraftBLUE');
                  Level.AddPrecacheMaterial(Material'VMVehicles-TX.HoverBikeGroup.NewHoverCraftNOcolor');
                  Level.AddPrecacheMaterial(Material'AW-2004Particles.Energy.AirBlast');
                  Level.AddPrecacheMaterial(Material'AW-2004Particles.Weapons.SmokePanels2');
                  Level.AddPrecacheMaterial(Material'Engine.GRADIENT_Fade');
              
                  Super.UpdatePrecacheMaterials();
              }
              
              defaultproperties
              { // the new default properties need to be enclosed inside the opening brace, {, to actually be part of the default properties
              ////Anim test part 1
                  // change the RunF/RunB/RunL/RunR/TurnR/TurnL/Idle_Rest to the names of the BF2142 mech animation would look best
                  MovementAnims(0)=Walk
                  MovementAnims(1)=WalkBack
                  MovementAnims(2)=StepLeft
                  MovementAnims(3)=StepRight
                  TurnRightAnim=Turn
                  TurnLeftAnim=Turn
                  IdleRestAnim=Idle
              ////
              //{
                   MaxPitchSpeed=1000.000000
                   JumpDuration=0.220000
                   JumpForceMag=100.000000
                   JumpDelay=3.000000
                   DuckForceMag=150.000000
                   JumpSound=ONSVehicleSounds-S.HoverBike.HoverBikeJump05
                   DuckSound=ONSVehicleSounds-S.HoverBike.HoverBikeTurbo01
                   JumpForce="HoverBikeJump"
                   ThrusterOffsets(0)=(X=95.000000,Z=200.000000)
                   HoverSoftness=0.220000
                   HoverPenScale=1.000000
                   HoverCheckDist=600.000000
                   UprightStiffness=500.000000
                   UprightDamping=500.000000
                   MaxThrustForce=2.000000
                   LongDamping=0.020000
                   MaxStrafeForce=1.000000
                   LatDamping=0.100000
                   TurnTorqueFactor=1000.000000
                   TurnTorqueMax=125.000000
                   TurnDamping=40.000000
                   MaxYawRate=1.500000
                   PitchTorqueFactor=200.000000
                   PitchTorqueMax=9.000000
                   PitchDamping=20.000000
                   RollTorqueTurnFactor=450.000000
                   RollTorqueStrafeFactor=200.000000
                   RollTorqueMax=1.500000
                   RollDamping=3.000000
                   StopThreshold=50.000000
              
                   DriverWeapons(0)=(None)
                   PassengerWeapons(0)=(None)
              
                   bHasAltFire=False
                   IdleSound=ONSVehicleSounds-S.HoverBike.HoverBikeEng02
                   StartUpSound=ONSVehicleSounds-S.HoverBike.HoverBikeStart01
                   ShutDownSound=ONSVehicleSounds-S.HoverBike.HoverBikeStop01
                   StartUpForce="HoverBikeStartUp"
                   ShutDownForce="HoverBikeShutDown""
                   DestroyedVehicleMesh=ONSDeadVehicles-SM.HoverBikeDead
                   DestructionEffectClass=Onslaught.ONSSmallVehicleExplosionEffect
                   DisintegrationEffectClass=Onslaught.ONSVehDeathHoverBike
                   DestructionLinearMomentum=(Min=62000.000000,Max=100000.000000)
                   DestructionAngularMomentum=(Min=25.000000,Max=75.000000)
                   DamagedEffectScale=0.600000
                   DamagedEffectOffset=(X=50.000000,Y=-25.000000,Z=10.000000)
                   ImpactDamageMult=0.000100
                   HeadlightCoronaOffset(0)=(X=73.000000,Y=10.000000,Z=14.000000)
                   HeadlightCoronaOffset(1)=(X=73.000000,Y=-10.000000,Z=14.000000)
                   HeadlightCoronaMaterial=Texture'EpicParticles.Flares.FlashFlare1'
                   HeadlightCoronaMaxSize=60.000000
                   bDrawDriverInTP=False
                   bTurnInPlace=True
                   bShowDamageOverlay=True
                   bScriptedRise=True
                   bShowChargingBar=True
                   bDriverHoldsFlag=True
                   bCanCarryFlag=True
                   DrivePos=(X=-50.000000,Z=75.000000)
                   ExitPositions(0)=(Y=300.000000,Z=100.000000)
                   ExitPositions(1)=(Y=-300.000000,Z=100.000000)
                   ExitPositions(2)=(X=350.000000,Z=100.000000)
                   ExitPositions(3)=(X=-350.000000,Z=100.000000)
                   ExitPositions(4)=(X=-350.000000,Z=-100.000000)
                   ExitPositions(5)=(X=350.000000,Z=-100.000000)
                   ExitPositions(6)=(Y=300.000000,Z=-100.000000)
                   ExitPositions(7)=(Y=-300.000000,Z=-100.000000)
                   EntryRadius=350.000000
                   FPCamPos=(X=100.000000,Z=500.000000)
                   TPCamDistance=500.000000
                   TPCamLookat=(X=100.000000,Z=50.000000)
                   TPCamWorldOffset=(Z=100.000000)
                   VehiclePositionString="in an BF2142 Mech"
                   VehicleNameString="BF2142 Mech"
                   RanOverDamageType=Onslaught.DamTypeHoverBikeHeadshot
                   CrushedDamageType=Onslaught.DamTypeHoverBikePancake
                   ObjectiveGetOutDist=750.000000
                   FlagBone="HoverCraft"
                   FlagOffset=(Z=45.000000)
                   FlagRotation=(Yaw=32768)
                   HornSounds(0)=ONSVehicleSounds-S.Horns.Horn02
                   HornSounds(1)=ONSVehicleSounds-S.Horns.La_Cucharacha_Horn
                   bCanStrafe=True
                   MeleeRange=-100.000000
                   GroundSpeed=700.000000
                   HealthMax=400.000000
                   Health=400
                   Mesh=SkeletalMesh'MegaForce_A.BF2142_Mech'
                   SoundRadius=900.000000
                   Begin Object Class=KarmaParamsRBFull Name=KParams0
                       KInertiaTensor(0)=1.300000
                       KLinearDamping=0.150000
                       KAngularDamping=200.000000
                       KStartEnabled=True
                       bHighDetailOnly=False
                       bClientOnly=False
                       bKDoubleTickRate=True
                       bKStayUpright=True
                       bKAllowRotate=True
                       bDestroyOnWorldPenetrate=True
                       bDoSafetime=True
                       KFriction=0.500000
                       KImpactThreshold=700.000000
                   End Object
                   KParams=KarmaParamsRBFull'MegaForce.BF2142_Chassis.KParams0'
              
              }
              Last edited by meowcatbuf; 03-27-2017, 09:16 PM.

              Comment


              • When I ran the mech with the anim code, all of the animations seem to work in game.
                One problem is the animations dont play until after 2 to 3 seconds of movement.
                Also the animations are playing back twice as fast as they should be.

                Another problem on my end was .psa was at a different height than the .psk so I fixed this,
                how ever I had to re-digest the animations to do this and I might have made a mistake.
                Because the "Idli" animation seems to be playing the "WalkForward" animation.
                I will be going back and re-traceing all my steps, or just re-do the digest animations.

                Code:
                //-----------------------------------------------------------
                //
                //-----------------------------------------------------------
                class BF2142_Chassis extends ONSHoverCraft;
                
                #exec OBJ LOAD FILE=..\Animations\MegaForce_A.ukx
                #exec OBJ LOAD FILE=..\textures\MegaForceTX.utx
                
                var()   float   MaxPitchSpeed;
                
                var()   float   JumpDuration;
                var()    float    JumpForceMag;
                var     float   JumpCountdown;
                var     float    JumpDelay, LastJumpTime;
                
                var()   float   DuckDuration;
                var()   float   DuckForceMag;
                var     float   DuckCountdown;
                
                var()    array<vector>                    BikeDustOffset;
                var()    float                            BikeDustTraceDistance;
                
                var()   sound                           JumpSound;
                var()   sound                           DuckSound;
                
                // Force Feedback
                var()    string                            JumpForce;
                
                var        array<ONSHoverBikeHoverDust>    BikeDust;
                var        array<vector>                    BikeDustLastNormal;
                
                var        bool                            DoBikeJump;
                var        bool                            OldDoBikeJump;
                
                var        bool                            DoBikeDuck;
                var        bool                            OldDoBikeDuck;
                var     bool                            bHoldingDuck;
                
                replication
                {
                    reliable if (bNetDirty && Role == ROLE_Authority)
                        DoBikeJump;
                }
                
                function Pawn CheckForHeadShot(Vector loc, Vector ray, float AdditionalScale)
                {
                    local vector X, Y, Z, newray;
                
                    GetAxes(Rotation,X,Y,Z);
                
                    if (Driver != None)
                    {
                        // Remove the Z component of the ray
                        newray = ray;
                        newray.Z = 0;
                        if (abs(newray dot X) < 0.7 && Driver.IsHeadShot(loc, ray, AdditionalScale))
                            return Driver;
                    }
                
                    return None;
                }
                
                simulated function Destroyed()
                {
                    local int i;
                
                    if (Level.NetMode != NM_DedicatedServer)
                    {
                        for (i = 0; i < BikeDust.Length; i++)
                            BikeDust[i].Destroy();
                
                        BikeDust.Length = 0;
                    }
                
                    Super.Destroyed();
                }
                
                simulated function DestroyAppearance()
                {
                    local int i;
                
                    if (Level.NetMode != NM_DedicatedServer)
                    {
                        for (i = 0; i < BikeDust.Length; i++)
                            BikeDust[i].Destroy();
                
                        BikeDust.Length = 0;
                    }
                
                    Super.DestroyAppearance();
                }
                
                function bool Dodge(eDoubleClickDir DoubleClickMove)
                {
                    Rise = 1;
                    return true;
                }
                
                function ChooseFireAt(Actor A)
                {
                    if (Pawn(A) != None && Vehicle(A) == None && VSize(A.Location - Location) < 1500 && Controller.LineOfSightTo(A))
                    {
                        if (!bWeaponIsAltFiring)
                            AltFire(0);
                    }
                    else if (bWeaponIsAltFiring)
                        VehicleCeaseFire(true);
                
                    Fire(0);
                }
                
                simulated event DrivingStatusChanged()
                {
                    local int i;
                
                    Super.DrivingStatusChanged();
                
                    if (bDriving && Level.NetMode != NM_DedicatedServer && BikeDust.Length == 0 && !bDropDetail)
                    {
                        BikeDust.Length = BikeDustOffset.Length;
                        BikeDustLastNormal.Length = BikeDustOffset.Length;
                
                        for(i=0; i<BikeDustOffset.Length; i++)
                            if (BikeDust[i] == None)
                            {
                                BikeDust[i] = spawn( class'ONSHoverBikeHoverDust', self,, Location + (BikeDustOffset[i] >> Rotation) );
                                BikeDust[i].SetDustColor( Level.DustColor );
                                BikeDustLastNormal[i] = vect(0,0,1);
                            }
                    }
                    else
                    {
                        if (Level.NetMode != NM_DedicatedServer)
                        {
                            for(i=0; i<BikeDust.Length; i++)
                                BikeDust[i].Destroy();
                
                            BikeDust.Length = 0;
                        }
                        JumpCountDown = 0.0;
                    }
                }
                
                simulated function Tick(float DeltaTime)
                {
                    local float EnginePitch, HitDist;
                    local int i;
                    local vector TraceStart, TraceEnd, HitLocation, HitNormal;
                    local actor HitActor;
                    local Emitter JumpEffect;
                
                    Super.Tick(DeltaTime);
                
                    EnginePitch = 64.0 + VSize(Velocity)/MaxPitchSpeed * 64.0;
                    SoundPitch = FClamp(EnginePitch, 64, 128);
                
                    JumpCountdown -= DeltaTime;
                
                    CheckJumpDuck();
                
                    UpdateMechAnim(DeltaTime);
                
                    if(DoBikeJump != OldDoBikeJump)
                    {
                        JumpCountdown = JumpDuration;
                        OldDoBikeJump = DoBikeJump;
                        if (Controller != Level.GetLocalPlayerController())
                        {
                            JumpEffect = Spawn(class'ONSHoverBikeJumpEffect');
                            JumpEffect.SetBase(Self);
                            ClientPlayForceFeedback(JumpForce);
                        }
                    }
                
                    if(Level.NetMode != NM_DedicatedServer && !bDropDetail)
                    {
                        for(i=0; i<BikeDust.Length; i++)
                        {
                            BikeDust[i].bDustActive = false;
                
                            TraceStart = Location + (BikeDustOffset[i] >> Rotation);
                            TraceEnd = TraceStart - ( BikeDustTraceDistance * vect(0,0,1) );
                
                            HitActor = Trace(HitLocation, HitNormal, TraceEnd, TraceStart, True);
                
                            if(HitActor == None)
                            {
                                BikeDust[i].UpdateHoverDust(false, 0);
                            }
                            else
                            {
                                HitDist = VSize(HitLocation - TraceStart);
                
                                BikeDust[i].SetLocation( HitLocation + 10*HitNormal);
                
                                BikeDustLastNormal[i] = Normal( 3*BikeDustLastNormal[i] + HitNormal );
                                BikeDust[i].SetRotation( Rotator(BikeDustLastNormal[i]) );
                
                                BikeDust[i].UpdateHoverDust(true, HitDist/BikeDustTraceDistance);
                
                                // If dust is just turning on, set OldLocation to current Location to avoid spawn interpolation.
                                if(!BikeDust[i].bDustActive)
                                    BikeDust[i].OldLocation = BikeDust[i].Location;
                
                                BikeDust[i].bDustActive = true;
                            }
                        }
                    }
                }
                
                ////Anim test part 2 // this call to the function is not inside the 'Tick' function code block, 
                // see edit above ;-) ^^^
                /* simply add this function call to your 'Tick' function right after CheckJumpDuck(); by adding this line
                
                UpdateMechAnim(DeltaTime); // this is actually inside a comment block because of the / and * and then * and / closing the comment block
                
                */
                ////
                
                function VehicleCeaseFire(bool bWasAltFire)
                {
                    Super.VehicleCeaseFire(bWasAltFire);
                
                    if (bWasAltFire)
                        bHoldingDuck = False;
                }
                
                simulated function float ChargeBar()
                {
                    // Clamp to 0.999 so charge bar doesn't blink when maxed
                    if (Level.TimeSeconds - JumpDelay < LastJumpTime)
                        return (FMin((Level.TimeSeconds - LastJumpTime) / JumpDelay, 0.999));
                    else
                        return 0.999;
                }
                
                simulated function CheckJumpDuck()
                {
                    local KarmaParams KP;
                    local Emitter JumpEffect, DuckEffect;
                    local bool bOnGround;
                    local int i;
                
                    KP = KarmaParams(KParams);
                
                    // Can only start a jump when in contact with the ground.
                    bOnGround = false;
                    for(i=0; i<KP.Repulsors.Length; i++)
                    {
                        if( KP.Repulsors[i] != None && KP.Repulsors[i].bRepulsorInContact )
                            bOnGround = true;
                    }
                
                    // If we are on the ground, and press Rise, and we not currently in the middle of a jump, start a new one.
                    if (JumpCountdown <= 0.0 && Rise > 0 && bOnGround && !bHoldingDuck && Level.TimeSeconds - JumpDelay >= LastJumpTime)
                    {
                        PlaySound(JumpSound,,1.0);
                
                        if (Role == ROLE_Authority)
                           DoBikeJump = !DoBikeJump;
                
                        if(Level.NetMode != NM_DedicatedServer)
                        {
                            JumpEffect = Spawn(class'ONSHoverBikeJumpEffect');
                            JumpEffect.SetBase(Self);
                            ClientPlayForceFeedback(JumpForce);
                        }
                
                        if ( AIController(Controller) != None )
                            Rise = 0;
                
                        LastJumpTime = Level.TimeSeconds;
                    }
                    else if (DuckCountdown <= 0.0 && (Rise < 0 || bWeaponIsAltFiring))
                    {
                        if (!bHoldingDuck)
                        {
                            bHoldingDuck = True;
                
                            PlaySound(DuckSound,,1.0);
                
                            DuckEffect = Spawn(class'ONSHoverBikeDuckEffect');
                            DuckEffect.SetBase(Self);
                
                            if ( AIController(Controller) != None )
                                Rise = 0;
                
                            JumpCountdown = 0.0; // Stops any jumping that was going on.
                        }
                    }
                    else
                       bHoldingDuck = False;
                }
                
                simulated function KApplyForce(out vector Force, out vector Torque)
                {
                    Super.KApplyForce(Force, Torque);
                
                    if (bDriving && JumpCountdown > 0.0)
                    {
                        Force += vect(0,0,1) * JumpForceMag;
                    }
                
                    if (bDriving && bHoldingDuck)
                    {
                        Force += vect(0,0,-1) * DuckForceMag;
                    }
                }
                
                ////Anim test part 3
                // Then paste this function code block in your code after the 'KApplyForce' 
                // function code block and before the 'StaticPrecache' function code block 
                // (you can actually paste the new function after any of the function code
                // blocks as long as it is after all of the class variables have been declared
                // at the top, and before you begin listing the default properties.
                
                simulated function UpdateMechAnim(float DeltaTime)
                {
                    local int NewAnimDirection;
                    local KRigidBodyState BodyState;
                    local float  TurnZAmount;
                    local vector VDirectionNormal;
                
                     // if we are on a server, don't bother playing the animations....
                     // though you might want to for collision purposes even if they don't completely sync up on the clients and server...
                    if ( Level.NetMode == NM_DedicatedServer )
                        return;
                    // Don't bother running the animations if this particular mech has 
                    // not been rendered for over a second on this computer
                    if (Level.TimeSeconds - LastRenderTime > 1.0){
                        return;
                    }
                    // Now start checking for whether the player is moving, standing still, or turning.
                    //  The check for 80 may sound like a lot, but for a vehicle, 80 UU/seconds is not very fast at all
                    // so we are basically standing still, or only moving very very slowly, so don't animate the legs 
                    // as walking
                    
                    if(VSize(Velocity) < 80)
                    {
                          KGetRigidBodyState(BodyState);
                           TurnZAmount = BodyState.AngVel.Z; // how much we are turning around the  Z-Axis, 
                     // I do not know what unit this is in: radians-per-second,  degrees-per-second, rotations-per-second, 
                     // URots-per-second it could eb  any of these.
                          if(Abs(TurnZAmount) > 40) // NOTE!!!!: you  will probably have to change the '40' to some other value 
                     // since I don't  know what the typical magnitude of the AngularVelocity (AngVel) would  be expected to see...
                          {
                              if(TurnZAmount  > 0) LoopAnim(TurnRightAnim, 1.0, 0.1f, 0); // you might need to swap  the '>' operator for '<' if the animations are turning the wrong  direction.
                              else LoopAnim(TurnLeftAnim, 1.0, 0.1f, 0);
                          }
                          else // we're not turning, so we must just be standing in place...
                              LoopAnim(IdleRestAnim, 1.0, 0.1f, 0);
                    }
                    // we must be moving then, so first lets check to see if we are falling
                    // and if we are not falling then, we're probably running around
                    else
                    {
                         VDirectionNormal = Normal(Velocity); // turn the velocity vector into a   'Unit Vector' (length == 1.0) 
                     // and see if it mostly points down
                        if(VDirectionNormal.Z < -0.8) // we are mostly falling!
                        {
                              LoopAnim(IdleRestAnim, 1.0, 0.1f, 0); // go ahead and play the IdleRestAnim while falling
                        } 
                        else
                        {
                               NewAnimDirection = Get4WayDirection(); // this native C++ function returns 0,1,2,  
                     // or 3 based on which direction the pawn is moving compared to their  facing direction
                              LoopAnim(MovementAnims[NewAnimDirection], 1.0, 0.1f, 0);
                        }
                    }
                }
                ////
                
                static function StaticPrecache(LevelInfo L)
                {
                    Super.StaticPrecache(L);
                
                    L.AddPrecacheStaticMesh(StaticMesh'ONSDeadVehicles-SM.HoverExploded.HoverWing');
                    L.AddPrecacheStaticMesh(StaticMesh'ONSDeadVehicles-SM.HoverExploded.HoverChair');
                    L.AddPrecacheStaticMesh(StaticMesh'AW-2004Particles.Debris.Veh_Debris2');
                    L.AddPrecacheStaticMesh(StaticMesh'AW-2004Particles.Debris.Veh_Debris1');
                    L.AddPrecacheStaticMesh(StaticMesh'ONSWeapons-SM.PC_MantaJumpBlast');
                
                    L.AddPrecacheMaterial(Material'ExplosionTex.Framed.exp2_frames');
                    L.AddPrecacheMaterial(Material'ExplosionTex.Framed.exp1_frames');
                    L.AddPrecacheMaterial(Material'ExplosionTex.Framed.we1_frames');
                    L.AddPrecacheMaterial(Material'AW-2004Particles.Fire.MuchSmoke1');
                    L.AddPrecacheMaterial(Material'AW-2004Particles.Fire.NapalmSpot');
                    L.AddPrecacheMaterial(Material'EpicParticles.Fire.SprayFire1');
                    L.AddPrecacheMaterial(Material'WeaponSkins.Skins.RocketTex0');
                    L.AddPrecacheMaterial(Material'AW-2004Particles.Energy.JumpDuck');
                    L.AddPrecacheMaterial(Material'VMVehicles-TX.HoverBikeGroup.hovercraftFANSblurTEX');
                    L.AddPrecacheMaterial(Material'VMVehicles-TX.HoverBikeGroup.hoverCraftRED');
                    L.AddPrecacheMaterial(Material'VMVehicles-TX.HoverBikeGroup.hoverCraftBLUE');
                    L.AddPrecacheMaterial(Material'VMVehicles-TX.HoverBikeGroup.NewHoverCraftNOcolor');
                    L.AddPrecacheMaterial(Material'AW-2004Particles.Energy.AirBlast');
                    L.AddPrecacheMaterial(Material'AW-2004Particles.Weapons.SmokePanels2');
                    L.AddPrecacheMaterial(Material'Engine.GRADIENT_Fade');
                
                }
                
                simulated function UpdatePrecacheStaticMeshes()
                {
                    Level.AddPrecacheStaticMesh(StaticMesh'ONSDeadVehicles-SM.HoverExploded.HoverWing');
                    Level.AddPrecacheStaticMesh(StaticMesh'ONSDeadVehicles-SM.HoverExploded.HoverChair');
                    Level.AddPrecacheStaticMesh(StaticMesh'AW-2004Particles.Debris.Veh_Debris2');
                    Level.AddPrecacheStaticMesh(StaticMesh'AW-2004Particles.Debris.Veh_Debris1');
                    Level.AddPrecacheStaticMesh(StaticMesh'ONSWeapons-SM.PC_MantaJumpBlast');
                    Level.AddPrecacheMaterial(Material'VMVehicles-TX.HoverBikeGroup.hovercraftFANSblurTEX');
                
                    Super.UpdatePrecacheStaticMeshes();
                }
                
                simulated function UpdatePrecacheMaterials()
                {
                    Level.AddPrecacheMaterial(Material'ExplosionTex.Framed.exp2_frames');
                    Level.AddPrecacheMaterial(Material'ExplosionTex.Framed.exp1_frames');
                    Level.AddPrecacheMaterial(Material'ExplosionTex.Framed.we1_frames');
                    Level.AddPrecacheMaterial(Material'AW-2004Particles.Fire.MuchSmoke1');
                    Level.AddPrecacheMaterial(Material'AW-2004Particles.Fire.NapalmSpot');
                    Level.AddPrecacheMaterial(Material'EpicParticles.Fire.SprayFire1');
                    Level.AddPrecacheMaterial(Material'WeaponSkins.Skins.RocketTex0');
                    Level.AddPrecacheMaterial(Material'AW-2004Particles.Energy.JumpDuck');
                    Level.AddPrecacheMaterial(Material'VMVehicles-TX.HoverBikeGroup.hoverCraftRED');
                    Level.AddPrecacheMaterial(Material'VMVehicles-TX.HoverBikeGroup.hoverCraftBLUE');
                    Level.AddPrecacheMaterial(Material'VMVehicles-TX.HoverBikeGroup.NewHoverCraftNOcolor');
                    Level.AddPrecacheMaterial(Material'AW-2004Particles.Energy.AirBlast');
                    Level.AddPrecacheMaterial(Material'AW-2004Particles.Weapons.SmokePanels2');
                    Level.AddPrecacheMaterial(Material'Engine.GRADIENT_Fade');
                
                    Super.UpdatePrecacheMaterials();
                }
                
                defaultproperties
                { // the new default properties need to be enclosed inside the opening brace, {, to actually be part of the default properties
                ////Anim test part 1
                    // change the RunF/RunB/RunL/RunR/TurnR/TurnL/Idle_Rest to the names of the BF2142 mech animation would look best
                    MovementAnims(0)=WalkForward
                    MovementAnims(1)=WalkBackward
                    MovementAnims(2)=StepLeft
                    MovementAnims(3)=StepRight
                    TurnRightAnim=Turn
                    TurnLeftAnim=Turn
                    IdleRestAnim=Idle
                ////
                //{
                     MaxPitchSpeed=1000.000000
                     JumpDuration=0.220000
                     JumpForceMag=100.000000
                     JumpDelay=3.000000
                     DuckForceMag=150.000000
                     JumpSound=ONSVehicleSounds-S.HoverBike.HoverBikeJump05
                     DuckSound=ONSVehicleSounds-S.HoverBike.HoverBikeTurbo01
                     JumpForce="HoverBikeJump"
                     ThrusterOffsets(0)=(X=95.000000,Z=200.000000)
                     HoverSoftness=0.220000
                     HoverPenScale=1.000000
                     HoverCheckDist=600.000000
                     UprightStiffness=500.000000
                     UprightDamping=500.000000
                     MaxThrustForce=2.000000
                     LongDamping=0.020000
                     MaxStrafeForce=1.000000
                     LatDamping=0.100000
                     TurnTorqueFactor=1000.000000
                     TurnTorqueMax=125.000000
                     TurnDamping=40.000000
                     MaxYawRate=1.500000
                     PitchTorqueFactor=200.000000
                     PitchTorqueMax=9.000000
                     PitchDamping=20.000000
                     RollTorqueTurnFactor=450.000000
                     RollTorqueStrafeFactor=200.000000
                     RollTorqueMax=1.500000
                     RollDamping=3.000000
                     StopThreshold=50.000000
                
                     DriverWeapons(0)=(WeaponClass=Class'MegaForce.BF2142_Main_Turret',WeaponBone="Main_Turret_Base")
                     PassengerWeapons(0)=(WeaponPawnClass=Class'MegaForce.BF2142_Gun_TurretPawn',WeaponBone="Gun_Turret_Base")
                
                     bHasAltFire=False
                     IdleSound=ONSVehicleSounds-S.HoverBike.HoverBikeEng02
                     StartUpSound=ONSVehicleSounds-S.HoverBike.HoverBikeStart01
                     ShutDownSound=ONSVehicleSounds-S.HoverBike.HoverBikeStop01
                     StartUpForce="HoverBikeStartUp"
                     ShutDownForce="HoverBikeShutDown""
                     DestroyedVehicleMesh=ONSDeadVehicles-SM.HoverBikeDead
                     DestructionEffectClass=Onslaught.ONSSmallVehicleExplosionEffect
                     DisintegrationEffectClass=Onslaught.ONSVehDeathHoverBike
                     DestructionLinearMomentum=(Min=62000.000000,Max=100000.000000)
                     DestructionAngularMomentum=(Min=25.000000,Max=75.000000)
                     DamagedEffectScale=0.600000
                     DamagedEffectOffset=(X=50.000000,Y=-25.000000,Z=10.000000)
                     ImpactDamageMult=0.000100
                     HeadlightCoronaOffset(0)=(X=73.000000,Y=10.000000,Z=14.000000)
                     HeadlightCoronaOffset(1)=(X=73.000000,Y=-10.000000,Z=14.000000)
                     HeadlightCoronaMaterial=Texture'EpicParticles.Flares.FlashFlare1'
                     HeadlightCoronaMaxSize=60.000000
                     bDrawDriverInTP=False
                     bTurnInPlace=True
                     bShowDamageOverlay=True
                     bScriptedRise=True
                     bShowChargingBar=True
                     bDriverHoldsFlag=True
                     bCanCarryFlag=True
                     DrivePos=(X=-50.000000,Z=75.000000)
                     ExitPositions(0)=(Y=300.000000,Z=100.000000)
                     ExitPositions(1)=(Y=-300.000000,Z=100.000000)
                     ExitPositions(2)=(X=350.000000,Z=100.000000)
                     ExitPositions(3)=(X=-350.000000,Z=100.000000)
                     ExitPositions(4)=(X=-350.000000,Z=-100.000000)
                     ExitPositions(5)=(X=350.000000,Z=-100.000000)
                     ExitPositions(6)=(Y=300.000000,Z=-100.000000)
                     ExitPositions(7)=(Y=-300.000000,Z=-100.000000)
                     EntryRadius=350.000000
                     FPCamPos=(X=100.000000,Z=500.000000)
                     TPCamDistance=500.000000
                     TPCamLookat=(X=100.000000,Z=50.000000)
                     TPCamWorldOffset=(Z=100.000000)
                     VehiclePositionString="in an BF2142 Mech"
                     VehicleNameString="BF2142 Mech"
                     RanOverDamageType=Onslaught.DamTypeHoverBikeHeadshot
                     CrushedDamageType=Onslaught.DamTypeHoverBikePancake
                     ObjectiveGetOutDist=750.000000
                     FlagBone="HoverCraft"
                     FlagOffset=(Z=45.000000)
                     FlagRotation=(Yaw=32768)
                     HornSounds(0)=ONSVehicleSounds-S.Horns.Horn02
                     HornSounds(1)=ONSVehicleSounds-S.Horns.La_Cucharacha_Horn
                     bCanStrafe=True
                     MeleeRange=-100.000000
                     GroundSpeed=700.000000
                     HealthMax=400.000000
                     Health=400
                     Mesh=SkeletalMesh'MegaForce_A.BF2142_Mech'
                     SoundRadius=900.000000
                     Begin Object Class=KarmaParamsRBFull Name=KParams0
                         KInertiaTensor(0)=1.300000
                         KLinearDamping=0.150000
                         KAngularDamping=200.000000
                         KStartEnabled=True
                         bHighDetailOnly=False
                         bClientOnly=False
                         bKDoubleTickRate=True
                         bKStayUpright=True
                         bKAllowRotate=True
                         bDestroyOnWorldPenetrate=True
                         bDoSafetime=True
                         KFriction=0.500000
                         KImpactThreshold=700.000000
                     End Object
                     KParams=KarmaParamsRBFull'MegaForce.BF2142_Chassis.KParams0'
                
                }

                Comment


                • Hi Maxx,
                  For the animation speed you have two options (pr possibly a combination of the two):
                  1. Change each animation sequence's play speed (rate) in the UnrealEd via the rate property (the tabs in the animation browser allow you to click on each animation sequence on the left hand window, and then edit the rate property AND things like translation and rotation). If the speed is 2x too fast, just divide the play rate by 2. Make sure to save the file once you are done modifying it.

                  2. Change the play rate in the 'LoopAnim' function calls in the code. Per the 'LoopAnim' function call explanation, the play rate is the second parameter in the function. So in the code I posted above just change the "1.0" that I listed in the four different calls to LoopAnim, to 0.5 instead.

                  I'm not entirely sure why the animations would not kick in immediately... hmmm. Is it only the first three seconds of the very first time that you begin driving the mech, or is it every time you change movement directions?

                  As for fixing the animation sequences: When ever I re-import a .psa file, I always choose to overwrite the animation sequences (I think I use the "File->Animation Append" option from the menu and then click the 'Overwrite Existing Sequences' radio button in addition to the 'Merge Sequences into Existing' radio button). Whenever you have two animation sequences (or really two of ANYTHING) in the same package (.ukx, .usx, .utx etc.) with exactly the same name, the engine gets "confused", and you can actually break an entire file. If you do want to import the .psa file again, but not overwrite the other sequences, you can import it again but change its name when you import it so that it becomes a separate animation set (however, you then have to link it to the mesh in code if you want to use sequences from both .psa animation sets since you can only have 1 default animation set).
                  Last edited by meowcatbuf; 03-28-2017, 08:37 PM.

                  Comment


                  • Originally posted by meowcatbuf View Post
                    I'm not entirely sure why the animations would not kick in immediately... hmmm. Is it only the first three seconds of the very first time that you begin driving the mech, or is it every time you change movement directions?
                    Well, when I walk forward the animation takes a few seconds for anim to start.
                    However when I stop walking forward the anim stop immediately.
                    Then when I try to move sideways/strafe left or right the animation takes a few seconds to start again.

                    EDIT:
                    (or it could be a second and half I have an impation nitpicky streak I try to curb at times)
                    Last edited by Mad Maxx; 03-29-2017, 02:46 AM.

                    Comment


                    • Maxx,
                      Here is an updated version of the Mech code, my changes highlighted in blue. This should be a bit more responsive. Also, I recommend you update the collision boxes on the mech main turret model (or chassis), so that it will collide with stuff.

                      Code:
                      //-----------------------------------------------------------
                      //
                      //-----------------------------------------------------------
                      class BF2142_Chassis extends ONSHoverCraft;
                      
                      #exec OBJ LOAD FILE=MegaForce_A.ukx
                      #exec OBJ LOAD FILE=MegaForceTX.utx
                      
                      var()   float   MaxPitchSpeed;
                      
                      var()   float   JumpDuration;
                      var()    float    JumpForceMag;
                      var     float   JumpCountdown;
                      var     float    JumpDelay, LastJumpTime;
                      
                      var()   float   DuckDuration;
                      var()   float   DuckForceMag;
                      var     float   DuckCountdown;
                      
                      var()    array<vector>                    BikeDustOffset;
                      var()    float                            BikeDustTraceDistance;
                      
                      var()   sound                           JumpSound;
                      var()   sound                           DuckSound;
                      
                      // Force Feedback
                      var()    string                            JumpForce;
                      
                      var        array<ONSHoverBikeHoverDust>    BikeDust;
                      var        array<vector>                    BikeDustLastNormal;
                      
                      var        bool                            DoBikeJump;
                      var        bool                            OldDoBikeJump;
                      
                      var        bool                            DoBikeDuck;
                      var        bool                            OldDoBikeDuck;
                      var     bool                            bHoldingDuck;
                      
                      //edited meowcat - vars below used to limit how much the mech is jerked around when taking damage
                      var() config float MomentumDamageThreshold; // if damage is less than this, multiply momentum by the scaler
                      var() config float MomentumScaler;
                      
                      replication
                      {
                          reliable if (bNetDirty && Role == ROLE_Authority)
                              DoBikeJump;
                      }
                      
                      function Pawn CheckForHeadShot(Vector loc, Vector ray, float AdditionalScale)
                      {
                          local vector X, Y, Z, newray;
                      
                          GetAxes(Rotation,X,Y,Z);
                      
                          if (Driver != None)
                          {
                              // Remove the Z component of the ray
                              newray = ray;
                              newray.Z = 0;
                              if (abs(newray dot X) < 0.7 && Driver.IsHeadShot(loc, ray, AdditionalScale))
                                  return Driver;
                          }
                      
                          return None;
                      }
                      
                      simulated function Destroyed()
                      {
                          local int i;
                      
                          if (Level.NetMode != NM_DedicatedServer)
                          {
                              for (i = 0; i < BikeDust.Length; i++)
                                  BikeDust[i].Destroy();
                      
                              BikeDust.Length = 0;
                          }
                      
                          Super.Destroyed();
                      }
                      
                      simulated function DestroyAppearance()
                      {
                          local int i;
                      
                          if (Level.NetMode != NM_DedicatedServer)
                          {
                              for (i = 0; i < BikeDust.Length; i++)
                                  BikeDust[i].Destroy();
                      
                              BikeDust.Length = 0;
                          }
                      
                          Super.DestroyAppearance();
                      }
                      
                      // edited Meowcat - added this function extension to turn off water collision so that the mech can walk into, rather than on, water
                      simulated function PostNetBeginPlay()
                      {
                          local KarmaParams kp;
                          local int i;
                      
                          Super.PostNetBeginPlay();
                          // Turn off water repulsion
                          kp = KarmaParams(KParams);
                      
                          for(i=0;i<kp.Repulsors.Length;i++){
                              kp.Repulsors[i].bRepulseWater = false;
                          }
                      }
                      
                      function bool Dodge(eDoubleClickDir DoubleClickMove)
                      {
                          Rise = 1;
                          return true;
                      }
                      
                      function ChooseFireAt(Actor A)
                      {
                          if (Pawn(A) != None && Vehicle(A) == None && VSize(A.Location - Location) < 1500 && Controller.LineOfSightTo(A))
                          {
                              if (!bWeaponIsAltFiring)
                                  AltFire(0);
                          }
                          else if (bWeaponIsAltFiring)
                              VehicleCeaseFire(true);
                      
                          Fire(0);
                      }
                      
                      simulated event DrivingStatusChanged()
                      {
                          local int i;
                      
                          Super.DrivingStatusChanged();
                      
                          if (bDriving && Level.NetMode != NM_DedicatedServer && BikeDust.Length == 0 && !bDropDetail)
                          {
                              BikeDust.Length = BikeDustOffset.Length;
                              BikeDustLastNormal.Length = BikeDustOffset.Length;
                      
                              for(i=0; i<BikeDustOffset.Length; i++)
                                  if (BikeDust[i] == None)
                                  {
                                      BikeDust[i] = spawn( class'ONSHoverBikeHoverDust', self,, Location + (BikeDustOffset[i] >> Rotation) );
                                      BikeDust[i].SetDustColor( Level.DustColor );
                                      BikeDustLastNormal[i] = vect(0,0,1);
                                  }
                          }
                          else
                          {
                              if (Level.NetMode != NM_DedicatedServer)
                              {
                                  for(i=0; i<BikeDust.Length; i++)
                                      BikeDust[i].Destroy();
                      
                                  BikeDust.Length = 0;
                              }
                              JumpCountDown = 0.0;
                             
                          }
                          if(!bDriving) LoopAnim(IdleRestAnim, 1.0, 0.1f, 0);
                      }
                      
                      simulated function Tick(float DeltaTime)
                      {
                          local float EnginePitch, HitDist;
                          local int i;
                          local vector TraceStart, TraceEnd, HitLocation, HitNormal;
                          local actor HitActor;
                          local Emitter JumpEffect;
                      
                          Super.Tick(DeltaTime);
                      
                          EnginePitch = 64.0 + VSize(Velocity)/MaxPitchSpeed * 64.0;
                          SoundPitch = FClamp(EnginePitch, 64, 128);
                      
                          JumpCountdown -= DeltaTime;
                      
                          CheckJumpDuck();
                      
                          UpdateMechAnim(DeltaTime);
                      
                          if(DoBikeJump != OldDoBikeJump)
                          {
                              JumpCountdown = JumpDuration;
                              OldDoBikeJump = DoBikeJump;
                              if (Controller != Level.GetLocalPlayerController())
                              {
                                  JumpEffect = Spawn(class'ONSHoverBikeJumpEffect');
                                  JumpEffect.SetBase(Self);
                                  ClientPlayForceFeedback(JumpForce);
                              }
                          }
                      
                          if(Level.NetMode != NM_DedicatedServer && !bDropDetail)
                          {
                              for(i=0; i<BikeDust.Length; i++)
                              {
                                  BikeDust[i].bDustActive = false;
                      
                                  TraceStart = Location + (BikeDustOffset[i] >> Rotation);
                                  TraceEnd = TraceStart - ( BikeDustTraceDistance * vect(0,0,1) );
                      
                                  HitActor = Trace(HitLocation, HitNormal, TraceEnd, TraceStart, True);
                      
                                  if(HitActor == None)
                                  {
                                      BikeDust[i].UpdateHoverDust(false, 0);
                                  }
                                  else
                                  {
                                      HitDist = VSize(HitLocation - TraceStart);
                      
                                      BikeDust[i].SetLocation( HitLocation + 10*HitNormal);
                      
                                      BikeDustLastNormal[i] = Normal( 3*BikeDustLastNormal[i] + HitNormal );
                                      BikeDust[i].SetRotation( Rotator(BikeDustLastNormal[i]) );
                      
                                      BikeDust[i].UpdateHoverDust(true, HitDist/BikeDustTraceDistance);
                      
                                      // If dust is just turning on, set OldLocation to current Location to avoid spawn interpolation.
                                      if(!BikeDust[i].bDustActive)
                                          BikeDust[i].OldLocation = BikeDust[i].Location;
                      
                                      BikeDust[i].bDustActive = true;
                                  }
                              }
                          }
                      }
                      
                      ////Anim test part 2 // this call to the function is not inside the 'Tick' function code block,
                      // see edit above ;-) ^^^
                      /* simply add this function call to your 'Tick' function right after CheckJumpDuck(); by adding this line
                      
                      UpdateMechAnim(DeltaTime); // this is actually inside a comment block because of the / and * and then * and / closing the comment block
                      
                      */
                      ////
                      
                      function VehicleCeaseFire(bool bWasAltFire)
                      {
                          Super.VehicleCeaseFire(bWasAltFire);
                      
                          if (bWasAltFire)
                              bHoldingDuck = False;
                      }
                      
                      simulated function float ChargeBar()
                      {
                          // Clamp to 0.999 so charge bar doesn't blink when maxed
                          if (Level.TimeSeconds - JumpDelay < LastJumpTime)
                              return (FMin((Level.TimeSeconds - LastJumpTime) / JumpDelay, 0.999));
                          else
                              return 0.999;
                      }
                      
                      simulated function CheckJumpDuck()
                      {
                          local KarmaParams KP;
                          local Emitter JumpEffect, DuckEffect;
                          local bool bOnGround;
                          local int i;
                      
                          KP = KarmaParams(KParams);
                      
                          // Can only start a jump when in contact with the ground.
                          bOnGround = false;
                          for(i=0; i<KP.Repulsors.Length; i++)
                          {
                              if( KP.Repulsors[i] != None && KP.Repulsors[i].bRepulsorInContact )
                                  bOnGround = true;
                          }
                      
                          // If we are on the ground, and press Rise, and we not currently in the middle of a jump, start a new one.
                          if (JumpCountdown <= 0.0 && Rise > 0 && bOnGround && !bHoldingDuck && Level.TimeSeconds - JumpDelay >= LastJumpTime)
                          {
                              PlaySound(JumpSound,,1.0);
                      
                              if (Role == ROLE_Authority)
                                 DoBikeJump = !DoBikeJump;
                      
                              if(Level.NetMode != NM_DedicatedServer)
                              {
                                  JumpEffect = Spawn(class'ONSHoverBikeJumpEffect');
                                  JumpEffect.SetBase(Self);
                                  ClientPlayForceFeedback(JumpForce);
                              }
                      
                              if ( AIController(Controller) != None )
                                  Rise = 0;
                      
                              LastJumpTime = Level.TimeSeconds;
                          }
                          else if (DuckCountdown <= 0.0 && (Rise < 0 || bWeaponIsAltFiring))
                          {
                              if (!bHoldingDuck)
                              {
                                  bHoldingDuck = True;
                      
                                  PlaySound(DuckSound,,1.0);
                      
                                  DuckEffect = Spawn(class'ONSHoverBikeDuckEffect');
                                  DuckEffect.SetBase(Self);
                      
                                  if ( AIController(Controller) != None )
                                      Rise = 0;
                      
                                  JumpCountdown = 0.0; // Stops any jumping that was going on.
                              }
                          }
                          else
                             bHoldingDuck = False;
                      }
                      
                      simulated function KApplyForce(out vector Force, out vector Torque)
                      {
                          Super.KApplyForce(Force, Torque);
                      
                          if (bDriving && JumpCountdown > 0.0)
                          {
                              Force += vect(0,0,1) * JumpForceMag;
                          }
                      
                          if (bDriving && bHoldingDuck)
                          {
                              Force += vect(0,0,-1) * DuckForceMag;
                          }
                      }
                      
                      ////Anim test part 3
                      // Then paste this function code block in your code after the 'KApplyForce'
                      // function code block and before the 'StaticPrecache' function code block
                      // (you can actually paste the new function after any of the function code
                      // blocks as long as it is after all of the class variables have been declared
                      // at the top, and before you begin listing the default properties.
                      
                      simulated function UpdateMechAnim(float DeltaTime)
                      {
                          local int NewAnimDirection;
                          local KRigidBodyState BodyState;
                          local float  TurnZAmount, Speed2D;  //edited meowcat
                          local vector VDirectionNormal;
                      
                           // if we are on a server, don't bother playing the animations....
                           // though you might want to for collision purposes even if they don't completely sync up on the clients and server...
                          if ( Level.NetMode == NM_DedicatedServer )
                              return;
                          // Don't bother running the animations if this particular mech has
                          // not been rendered for over a second on this computer
                          if (Level.TimeSeconds - LastRenderTime > 1.0){
                              return;
                          }
                          // Now start checking for whether the player is moving, standing still, or turning.
                          //  The check for 80 may sound like a lot, but for a vehicle, 80 UU/seconds is not very fast at all
                          // so we are basically standing still, or only moving very very slowly, so don't animate the legs
                          // as walking
                      
                          if(VSize(Velocity) < 80)
                          {
                                KGetRigidBodyState(BodyState);
                                 TurnZAmount = BodyState.AngVel.Z; // how much we are turning around the  Z-Axis,
                           // I do not know what unit this is in: radians-per-second,  degrees-per-second, rotations-per-second,
                           // URots-per-second it could eb  any of these.
                                if(Abs(TurnZAmount) > 0.5)
                           // since I don't  know what the typical magnitude of the AngularVelocity (AngVel) would  be expected to see...
                                {
                                    if(TurnZAmount  > 0) LoopAnim(TurnRightAnim, 1.0, 0.1f, 0); // you might need to swap  the '>' operator for '<' if the animations are turning the wrong  direction.
                                    else LoopAnim(TurnLeftAnim, 1.0, 0.1f, 0);
                                }
                                else // we're not turning, so we must just be standing in place...
                                    LoopAnim(IdleRestAnim, 1.0, 0.1f, 0);
                          }
                          // we must be moving then, so first lets check to see if we are falling
                          // and if we are not falling then, we're probably running around
                          else
                          {
                              VDirectionNormal = Normal(Velocity); // turn the velocity vector into a   'Unit Vector' (length == 1.0)
                                          // and see if it mostly points down
                      
                              if(VDirectionNormal.Z < -0.8) // we are mostly falling!
                              {
                                    LoopAnim(IdleRestAnim, 1.0, 0.1f, 0); // go ahead and play the IdleRestAnim while falling
                              }
                              else
                              {
                                     Speed2D = VSize(Velocity);
                                     Speed2D /= 1000; // 1000 was about the velocity that the animation looked OK at
                                     NewAnimDirection = Get4WayDirection(); // this native C++ function returns 0,1,2,
                           // or 3 based on which direction the pawn is moving compared to their  facing direction
                                    LoopAnim(MovementAnims[NewAnimDirection], Speed2D , 0.1f, 0); //edited meowcat
                              }
                          }
                      }
                      ////
                      
                      // make sure we don't screw up getting knocked around too badly!!
                      function TakeDamage(int Damage, Pawn instigatedBy, Vector Hitlocation, Vector Momentum, class<DamageType> DamageType){
                          if(damage < MomentumDamageThreshold && MomentumScaler !=1.0) Momentum *= MomentumScaler;// no momentum to spin the vehicle around
                          Super.TakeDamage(Damage, instigatedBy, Hitlocation, Momentum, damageType);
                      }
                      
                      static function StaticPrecache(LevelInfo L)
                      {
                          Super.StaticPrecache(L);
                      
                          L.AddPrecacheStaticMesh(StaticMesh'ONSDeadVehicles-SM.HoverExploded.HoverWing');
                          L.AddPrecacheStaticMesh(StaticMesh'ONSDeadVehicles-SM.HoverExploded.HoverChair');
                          L.AddPrecacheStaticMesh(StaticMesh'AW-2004Particles.Debris.Veh_Debris2');
                          L.AddPrecacheStaticMesh(StaticMesh'AW-2004Particles.Debris.Veh_Debris1');
                          L.AddPrecacheStaticMesh(StaticMesh'ONSWeapons-SM.PC_MantaJumpBlast');
                      
                          L.AddPrecacheMaterial(Material'ExplosionTex.Framed.exp2_frames');
                          L.AddPrecacheMaterial(Material'ExplosionTex.Framed.exp1_frames');
                          L.AddPrecacheMaterial(Material'ExplosionTex.Framed.we1_frames');
                          L.AddPrecacheMaterial(Material'AW-2004Particles.Fire.MuchSmoke1');
                          L.AddPrecacheMaterial(Material'AW-2004Particles.Fire.NapalmSpot');
                          L.AddPrecacheMaterial(Material'EpicParticles.Fire.SprayFire1');
                          L.AddPrecacheMaterial(Material'WeaponSkins.Skins.RocketTex0');
                          L.AddPrecacheMaterial(Material'AW-2004Particles.Energy.JumpDuck');
                          L.AddPrecacheMaterial(Material'VMVehicles-TX.HoverBikeGroup.hovercraftFANSblurTEX');
                          L.AddPrecacheMaterial(Material'VMVehicles-TX.HoverBikeGroup.hoverCraftRED');
                          L.AddPrecacheMaterial(Material'VMVehicles-TX.HoverBikeGroup.hoverCraftBLUE');
                          L.AddPrecacheMaterial(Material'VMVehicles-TX.HoverBikeGroup.NewHoverCraftNOcolor');
                          L.AddPrecacheMaterial(Material'AW-2004Particles.Energy.AirBlast');
                          L.AddPrecacheMaterial(Material'AW-2004Particles.Weapons.SmokePanels2');
                          L.AddPrecacheMaterial(Material'Engine.GRADIENT_Fade');
                      
                      }
                      
                      simulated function UpdatePrecacheStaticMeshes()
                      {
                          Level.AddPrecacheStaticMesh(StaticMesh'ONSDeadVehicles-SM.HoverExploded.HoverWing');
                          Level.AddPrecacheStaticMesh(StaticMesh'ONSDeadVehicles-SM.HoverExploded.HoverChair');
                          Level.AddPrecacheStaticMesh(StaticMesh'AW-2004Particles.Debris.Veh_Debris2');
                          Level.AddPrecacheStaticMesh(StaticMesh'AW-2004Particles.Debris.Veh_Debris1');
                          Level.AddPrecacheStaticMesh(StaticMesh'ONSWeapons-SM.PC_MantaJumpBlast');
                          Level.AddPrecacheMaterial(Material'VMVehicles-TX.HoverBikeGroup.hovercraftFANSblurTEX');
                      
                          Super.UpdatePrecacheStaticMeshes();
                      }
                      
                      simulated function UpdatePrecacheMaterials()
                      {
                          Level.AddPrecacheMaterial(Material'ExplosionTex.Framed.exp2_frames');
                          Level.AddPrecacheMaterial(Material'ExplosionTex.Framed.exp1_frames');
                          Level.AddPrecacheMaterial(Material'ExplosionTex.Framed.we1_frames');
                          Level.AddPrecacheMaterial(Material'AW-2004Particles.Fire.MuchSmoke1');
                          Level.AddPrecacheMaterial(Material'AW-2004Particles.Fire.NapalmSpot');
                          Level.AddPrecacheMaterial(Material'EpicParticles.Fire.SprayFire1');
                          Level.AddPrecacheMaterial(Material'WeaponSkins.Skins.RocketTex0');
                          Level.AddPrecacheMaterial(Material'AW-2004Particles.Energy.JumpDuck');
                          Level.AddPrecacheMaterial(Material'VMVehicles-TX.HoverBikeGroup.hoverCraftRED');
                          Level.AddPrecacheMaterial(Material'VMVehicles-TX.HoverBikeGroup.hoverCraftBLUE');
                          Level.AddPrecacheMaterial(Material'VMVehicles-TX.HoverBikeGroup.NewHoverCraftNOcolor');
                          Level.AddPrecacheMaterial(Material'AW-2004Particles.Energy.AirBlast');
                          Level.AddPrecacheMaterial(Material'AW-2004Particles.Weapons.SmokePanels2');
                          Level.AddPrecacheMaterial(Material'Engine.GRADIENT_Fade');
                      
                          Super.UpdatePrecacheMaterials();
                      }
                      
                      defaultproperties
                      { // the new default properties need to be enclosed inside the opening brace, {, to actually be part of the default properties
                      ////Anim test part 1
                          // change the RunF/RunB/RunL/RunR/TurnR/TurnL/Idle_Rest to the names of the BF2142 mech animation would look best
                          MovementAnims(0)=WalkForward
                          MovementAnims(1)=WalkBackward
                          MovementAnims(2)=StepLeft
                          MovementAnims(3)=StepRight
                          TurnRightAnim=Turn
                          TurnLeftAnim=Turn
                          IdleRestAnim=Idle
                      ////
                      //{
                           MaxPitchSpeed=1000.000000
                           JumpDuration=0.220000
                           JumpForceMag=100.000000
                           JumpDelay=3.000000
                           DuckForceMag=150.000000
                           JumpSound=ONSVehicleSounds-S.HoverBike.HoverBikeJump05
                           DuckSound=ONSVehicleSounds-S.HoverBike.HoverBikeTurbo01
                           JumpForce="HoverBikeJump"
                           ThrusterOffsets(0)=(X=0.0,Z=200.0) //edited meowcat
                           HoverSoftness=0.220000
                           HoverPenScale=1.000000
                           HoverCheckDist=600.0
                           UprightStiffness=500.000000
                           UprightDamping=500.000000
                           MaxThrustForce=16.000000 //edited meowcat
                           LongDamping=0.020000
                           MaxStrafeForce=10.000000 //edited meowcat
                           LatDamping=0.100000
                           TurnTorqueFactor=1000.000000
                           TurnTorqueMax=125.000000
                           TurnDamping=40.000000
                           MaxYawRate=1.500000
                           PitchTorqueFactor=200.000000
                           PitchTorqueMax=9.000000
                           PitchDamping=20.000000
                           RollTorqueTurnFactor=450.000000
                           RollTorqueStrafeFactor=200.000000
                           RollTorqueMax=1.500000
                           RollDamping=3.000000
                           StopThreshold=50.000000
                      
                           VehicleMass=1.1 // edited meowcat
                           bTraceWater=false // edited meowcat
                           MomentumDamageThreshold=200 // edited meowcat
                           MomentumScaler=0.05 // edited meowcat
                           CollisionRadius=+360.0 // edited meowcat
                           CollisionHeight=+400.0 // edited meowcat
                      
                           DriverWeapons(0)=(WeaponClass=Class'MegaForce.BF2142_Main_Turret',WeaponBone="Main_Turret_Base")
                           PassengerWeapons(0)=(WeaponPawnClass=Class'MegaForce.BF2142_Gun_TurretPawn',WeaponBone="Gun_Turret_Base")
                      
                           bHasAltFire=False
                           IdleSound=ONSVehicleSounds-S.HoverBike.HoverBikeEng02
                           StartUpSound=ONSVehicleSounds-S.HoverBike.HoverBikeStart01
                           ShutDownSound=ONSVehicleSounds-S.HoverBike.HoverBikeStop01
                           StartUpForce="HoverBikeStartUp"
                           ShutDownForce="HoverBikeShutDown""
                           DestroyedVehicleMesh=ONSDeadVehicles-SM.HoverBikeDead
                           DestructionEffectClass=Onslaught.ONSSmallVehicleExplosionEffect
                           DisintegrationEffectClass=Onslaught.ONSVehDeathHoverBike
                           DestructionLinearMomentum=(Min=62000.000000,Max=100000.000000)
                           DestructionAngularMomentum=(Min=25.000000,Max=75.000000)
                           DamagedEffectScale=0.600000
                           DamagedEffectOffset=(X=50.000000,Y=-25.000000,Z=10.000000)
                           ImpactDamageMult=0.000100
                           HeadlightCoronaOffset(0)=(X=73.000000,Y=10.000000,Z=14.000000)
                           HeadlightCoronaOffset(1)=(X=73.000000,Y=-10.000000,Z=14.000000)
                           HeadlightCoronaMaterial=Texture'EpicParticles.Flares.FlashFlare1'
                           HeadlightCoronaMaxSize=60.000000
                           bDrawDriverInTP=False
                           bTurnInPlace=True
                           bShowDamageOverlay=True
                           bScriptedRise=True
                           bShowChargingBar=True
                           bDriverHoldsFlag=True
                           bCanCarryFlag=True
                           DrivePos=(X=-50.000000,Z=75.000000)
                           ExitPositions(0)=(Y=300.000000,Z=100.000000)
                           ExitPositions(1)=(Y=-300.000000,Z=100.000000)
                           ExitPositions(2)=(X=350.000000,Z=100.000000)
                           ExitPositions(3)=(X=-350.000000,Z=100.000000)
                           ExitPositions(4)=(X=-350.000000,Z=-100.000000)
                           ExitPositions(5)=(X=350.000000,Z=-100.000000)
                           ExitPositions(6)=(Y=300.000000,Z=-100.000000)
                           ExitPositions(7)=(Y=-300.000000,Z=-100.000000)
                           EntryRadius=350.000000
                           FPCamPos=(X=100.000000,Z=500.000000)
                           TPCamDistance=500.000000
                           TPCamLookat=(X=100.000000,Z=50.000000)
                           TPCamWorldOffset=(Z=100.000000)
                           VehiclePositionString="in an BF2142 Mech"
                           VehicleNameString="BF2142 Mech"
                           RanOverDamageType=Onslaught.DamTypeHoverBikeHeadshot
                           CrushedDamageType=Onslaught.DamTypeHoverBikePancake
                           ObjectiveGetOutDist=750.000000
                           FlagBone="HoverCraft"
                           FlagOffset=(Z=45.00)
                           FlagRotation=(Yaw=32768)
                           HornSounds(0)=ONSVehicleSounds-S.Horns.Horn02
                           HornSounds(1)=ONSVehicleSounds-S.Horns.La_Cucharacha_Horn
                           bCanStrafe=True
                           MeleeRange=-100.00
                           GroundSpeed=700.00
                           HealthMax=400.000000
                           Health=400
                           Mesh=SkeletalMesh'MegaForce_A.BF2142_Mech'
                           SoundRadius=900.0
                           Begin Object Class=KarmaParamsRBFull Name=KParams0
                               KInertiaTensor(0)=1.300000
                               KLinearDamping=0.150000
                               KAngularDamping=200.000000
                               KStartEnabled=True
                               bHighDetailOnly=False
                               bClientOnly=False
                               bKDoubleTickRate=True
                               bKStayUpright=True
                               bKAllowRotate=True
                               bDestroyOnWorldPenetrate=True
                               bDoSafetime=True
                               KFriction=0.500000
                               KImpactThreshold=700.0
                               KMaxSpeed=800.0 // meowcat edited
                           End Object
                           KParams=KarmaParamsRBFull'MegaForce.BF2142_Chassis.KParams0'
                      
                      }
                      And on a side note, here is the link to the default native pawn animation code converted to UScript (I did the conversion about 9'ish years ago to support adding some parkour/Splinter Cell style aniamtions and capabilities to the pawn code).
                      Last edited by meowcatbuf; 04-01-2017, 05:55 PM.

                      Comment


                      • Hey meowcat,
                        I tried out the new code you made an everything work perfectly.
                        The animation is very smooth and looks well polished, excellent coding.
                        Thanks.
                        Last edited by Mad Maxx; 04-03-2017, 12:26 AM.

                        Comment

                        Working...
                        X