I need help making a minigun turret's barrels spin while firing without an animation. So far I've tried adding:
to the vehicle's weapon pawn and:
to my vehicle's weapon with no effect. (code adapted from the AS minigun turret)
btw-I havent gotten any odd messages in the log file and the bone name is correct.
Code:
simulated function PostBeginPlay() { local Rotator R; super.PostBeginPlay(); R = GetBoneRotation( 'Cannons' ); CurrentCannonRoll = R.Yaw; } /* Firing state: Updates cannon rotation */ state Firing { simulated function Tick(float deltaTime) { local rotator R; if ( Instigator == None ) return; if ( bWeaponIsFiring && (Level.TimeSeconds - LastFireTime > 0.5) ) StopFiring(); if ( bWeaponIsFiring ) { // Increase rotation rate... if ( CurrentRollSpeed < CannonRollSpeed ) CurrentRollSpeed += RollSpeedAcc * 4.f * deltaTime; // faster acceleration when shooting else if ( CurrentRollSpeed > CannonRollSpeed ) CurrentRollSpeed = CannonRollSpeed; } else { // decrease rotation rate... if ( CurrentRollSpeed > 0 ) CurrentRollSpeed -= RollSpeedAcc * deltaTime; // If rotation rate is null, exit state.. if ( CurrentRollSpeed < 0 ) { CurrentRollSpeed = 0; GotoState(''); } } // Rotating cannon CurrentCannonRoll = (CurrentCannonRoll + CurrentRollSpeed * deltatime) % 65536; R.Roll = CurrentCannonRoll; Instigator.SetBoneRotation('Cannons', R, 0, 1.f); } } simulated Event StartFiring() { bWeaponIsFiring = true; // if ( Instigator != None ) // Instigator.AmbientSound = FiringSound; GotoState('Firing'); } simulated function vector GetFireStart( vector RelOffset ) { local vector X, Y, Z; GetViewAxes(X, Y, Z); return Instigator.Location + X*RelOffset.X + Y*RelOffset.Y + Z*RelOffset.Z; } simulated function GetViewAxes( out vector xaxis, out vector yaxis, out vector zaxis ) { GetAxes( Instigator.Rotation, xaxis, yaxis, zaxis ); } simulated Event StopFiring() { if ( !bWeaponIsFiring ) return; bFiring = false; }
Code:
simulated function PostBeginPlay() { local Rotator R; super.PostBeginPlay(); R = GetBoneRotation( 'Cannons' ); CurrentCannonRoll = R.Yaw; } /* Firing state: Updates cannon rotation */ state Firing { simulated function Tick(float deltaTime) { local rotator R; if ( Instigator == None ) return; if ( bIsRepeatingFF && (Level.TimeSeconds - LastFireTime > 0.5) ) StopFiring(); if ( bIsRepeatingFF ) { // Increase rotation rate... if ( CurrentRollSpeed < CannonRollSpeed ) CurrentRollSpeed += RollSpeedAcc * 4.f * deltaTime; // faster acceleration when shooting else if ( CurrentRollSpeed > CannonRollSpeed ) CurrentRollSpeed = CannonRollSpeed; } else { // decrease rotation rate... if ( CurrentRollSpeed > 0 ) CurrentRollSpeed -= RollSpeedAcc * deltaTime; // If rotation rate is null, exit state.. if ( CurrentRollSpeed < 0 ) { CurrentRollSpeed = 0; GotoState(''); } } // Rotating cannon CurrentCannonRoll = (CurrentCannonRoll + CurrentRollSpeed * deltatime) % 65536; R.Roll = CurrentCannonRoll; Instigator.SetBoneRotation('Cannons', R, 0, 1.f); } } simulated Event StartFiring() { bIsRepeatingFF = true; // if ( Instigator != None ) // Instigator.AmbientSound = FiringSound; GotoState('Firing'); } simulated function vector GetFireStart( vector RelOffset ) { local vector X, Y, Z; GetViewAxes(X, Y, Z); return Instigator.Location + X*RelOffset.X + Y*RelOffset.Y + Z*RelOffset.Z; } simulated function GetViewAxes( out vector xaxis, out vector yaxis, out vector zaxis ) { GetAxes( Instigator.Rotation, xaxis, yaxis, zaxis ); } simulated Event StopFiring() { if ( !bFiring ) return; bIsRepeatingFF = false; }
btw-I havent gotten any odd messages in the log file and the bone name is correct.
Comment