Core.Object | +--Engine.Actor | +--Engine.Decoration | +--XIII.VehicleDeco | +--XIDMaps.HarrierDeco
Rotator
IniRot
void
PostBeginPlay()
00001 // 00002 //----------------------------------------------------------- 00003 class HarrierDeco extends VehicleDeco; 00004 00005 //VAR vector OldLocation; 00006 VAR(Vehicle) bool bStarter; 00007 VAR(Vehicle) float Pitch; 00008 VAR Rotator IniRot; 00009 00010 function PostBeginPlay() 00011 { 00012 LOCAL int i; 00013 00014 if (!bStarter) 00015 PartClass[2]=none; 00016 00017 if(bActorShadows && (Shadow==None) ) 00018 { 00019 Shadow = Spawn( class'ShadowProjector', Self, '', Location ); 00020 Shadow.ShadowScale = 8; 00021 Shadow.MaxTraceDistance=2500; 00022 Shadow.ShadowIntensity=196; 00023 // LOG ("SHADOW :"@Shadow); 00024 } 00025 00026 for ( i=0; i<3; i++ ) 00027 { 00028 // log ("-->"@PartClass[i]); 00029 if ( PartClass[i] != None ) 00030 { 00031 VehicleParts[i] = spawn(PartClass[i],self,,Location+(PartOffset[i]>>Rotation)); //.X * X + PartOffset[i].Y * Y + PartOffset[i].Z * Z); 00032 if ( VehicleParts[i] == None ) 00033 log("WARNING - "$PartClass[i]$" failed to spawn for "$self); 00034 else 00035 { 00036 // log("==> new vehicle part spawned"@VehicleParts[i]); 00037 VehicleParts[i].SetRotation(Rotation); 00038 VehicleParts[i].SetBase(self); 00039 // VehicleParts[i].AttachTag=Tag; 00040 NumParts++; 00041 } 00042 } 00043 else 00044 break; 00045 } 00046 // log ("########################################################################"); 00047 00048 if (LinkedTo==none) 00049 { 00050 Disable('Tick'); 00051 } 00052 else 00053 { 00054 YawOffset=Rotation.Yaw-LinkedTo.Rotation.Yaw; 00055 PositionOffset=(Location-LinkedTo.Location)<<Rotation; 00056 } 00057 // Super.PostBeginPlay(); 00058 IniRot=Rotation; 00059 } 00060 00061 EVENT Tick(float dt) 00062 { 00063 LOCAL vector vTmp,gSpot, X, Y, Z; 00064 LOCAL rotator r; 00065 LOCAL float SpeedZ, SpeedH; 00066 00067 // LOCAL Pawn HitPawn; 00068 // LOCAL Vector HitLocation,HitNormal,MemHit; 00069 00070 if (LinkedTo==none) 00071 { 00072 Disable('Tick'); 00073 return; 00074 } 00075 gSpot = LinkedTo.Location + PositionOffset; 00076 // gSpot.z += ZOffset; 00077 00078 vTmp=gSpot-Location; 00079 SpeedZ=vTmp.Z/dt; 00080 SpeedH=sqrt(vTmp.X*vTmp.X+vTmp.Y*vTmp.Y)/dt; 00081 if ( bStarter ) 00082 { 00083 r = LinkedTo.Rotation; 00084 if ( SpeedH<500 ) 00085 { 00086 if ( SpeedZ<300 ) 00087 r.Pitch= SpeedZ*(SpeedZ-300)*0.25; 00088 else 00089 r.Pitch=0; 00090 } 00091 00092 GetAxes( r, x, y, z); 00093 r=OrthoRotation(y,-x,z) - Rotation; 00094 r = r * (1-inertia) + Rotation; 00095 SetRotation(r); 00096 // log( "STARTER"@r ); 00097 } 00098 else 00099 { 00100 // vTmp=vTmp>>IniRot; 00101 // log (vTmp ); 00102 if (SpeedH>500) 00103 { 00104 r.Pitch = Pitch; 00105 r.Roll = 0; 00106 r.Yaw = IniRot.Yaw; 00107 r = r * (1-inertia) + inertia * Rotation; 00108 } 00109 else 00110 { 00111 r.Pitch = 0; 00112 r.Roll = 0; 00113 r.Yaw = IniRot.Yaw; 00114 // r = LinkedTo.Rotation; 00115 // GetAxes( r, x, y, z); 00116 // r=OrthoRotation(y,-x,z) - Rotation; 00117 // r = r * (1-inertia) + Rotation; 00118 } 00119 SetRotation(r); 00120 // log( "NO STARTER"@r ); 00121 } 00122 SetLocation( gSpot ); 00123 // if (!bStarter) 00124 // log (LinkedTo.Location+PositionOffset-gSpot); 00125 00126 } 00127 00128 // up StaticMesh'Meshes_Vehicules.cokpit' 00129 // down StaticMesh'Meshes_Vehicules.cokpit_stat' 00130 // wheels StaticMesh'Meshes_Vehicules.harrier_roue' 00131 00132 00133 00134 defaultproperties 00135 { 00136 PartClass(0)=Class'XIDMaps.HarrierMovingCockpit' 00137 PartClass(1)=Class'XIDMaps.HarrierStaticCockpit' 00138 PartClass(2)=Class'XIDMaps.HarrierCockpitUndercarriage' 00139 bHighDetail=True 00140 DrawType=DT_StaticMesh 00141 StaticMesh=StaticMesh'Meshes_Vehicules.Harrier' 00142 CollisionHeight=10.000000 00143 }