Overview Package Class Source Class tree Glossary
previous class      next class frames      no frames

Engine.HavokVehicle


00001
00002
00003
00004
00005
00006
00007
00008
00009
00010
00011
00012
00013
00014
00015
00016
00017
00018
00019
00020
00021
00022
00023
00024
00025
00026
00027
00028
00029
00030
00031
00032
00033
00034
00035
00036
00037
00038
00039
00040
00041
00042
00043
00044
00045
00046
00047
00048
00049
00050
00051
00052
00053
00054
00055
00056
00057
00058
00059
00060
00061
00062
00063
00064
00065
00066
00067
00068
00069
00070
00071
00072
00073
00074
00075
00076
00077
00078
00079
00080
00081
00082
00083
00084
00085
00086
00087
00088
00089
00090
00091
00092
00093
00094
00095
00096
00097
00098
00099
00100
00101
00102
00103
00104
00105
00106
00107
00108
00109
00110
00111
00112
00113
00114
00115
00116
00117
00118
00119
00120
00121
00122
00123
00124
00125
00126
00127
00128
00129
00130
00131
00132
00133
00134
00135
00136
00137
00138
00139
00140
00141
00142
00143
00144
00145
00146
00147
00148
00149
00150
00151
00152
00153
00154
00155
00156
00157
00158
00159
00160
00161
00162
00163
00164
00165
00166
00167
00168
00169
00170
00171
00172
00173
00174
00175
00176
00177
00178
00179
00180
00181
00182
00183
00184
00185
00186
00187
00188
00189
00190
00191
00192
00193
00194
00195
00196
00197
00198
00199
00200
00201
00202
00203
00204
00205
00206
00207
00208
00209
00210
00211
00212
00213
00214
00215
00216
00217
00218
00219
00220
00221
00222
00223
00224
00225
00226
00227
00228
00229
00230
00231
00232
00233
00234
00235
00236
00237
00238
00239
00240
00241
00242
00243
00244
00245
00246
00247
00248
00249
00250
00251
00252
00253
00254
00255
00256
00257
00258
00259
00260
00261
00262
00263
00264
00265
00266
00267
00268
00269
00270
00271
00272
00273
00274
00275
00276
00277
00278
00279
00280
00281
00282
00283
00284
00285
00286
00287
00288
00289
00290
00291
00292
00293
00294
00295
00296
00297
00298
00299
00300
00301
00302
00303
00304
00305
00306
00307
00308
00309
00310
00311
00312
00313
00314
00315
00316
00317
00318
00319
00320
00321
00322
00323
00324
00325
00326
00327
00328
00329
00330
00331
00332
00333
00334
00335
00336
00337
00338
00339
00340
00341
00342
00343
00344
00345
00346
00347
00348
00349
00350
00351
00352
00353
00354
00355
00356
00357
00358
00359
00360
00361
00362
00363
00364
00365
00366
00367
00368
00369
00370
00371
00372
00373
00374
00375
00376
00377
00378
00379
00380
00381
00382
00383
00384
00385
00386
00387
00388
00389
00390
00391
00392
00393
00394
00395
00396
00397
00398
00399
00400
00401
00402
00403
00404
00405
00406
00407
00408
00409
00410
00411
00412
00413
00414
00415
00416
00417
00418
00419
00420
00421
00422
00423
00424
00425
00426
00427
00428
00429
00430
00431
00432
00433
00434
00435
00436
00437
00438
00439
00440
00441
00442
00443
00444
00445
00446
00447
00448
00449
00450
00451
00452
00453
00454
00455
00456
00457
00458
00459
00460
00461
00462
00463
00464
00465
00466
00467
00468
00469
00470
00471
00472
00473
00474
00475
00476
00477
00478
00479
00480
00481
00482
00483
00484
00485
00486
00487
00488
00489
00490
00491
00492
00493
00494
00495
00496
00497
00498
00499
00500
00501
00502
00503
00504
00505
00506
00507
00508
00509
00510
00511
00512
00513
00514
00515
00516
00517
00518
00519
00520
00521
00522
00523
00524
00525
00526
00527
00528
00529
00530
00531
00532
00533
00534
00535
00536
00537
00538
00539
00540
00541
00542
00543
00544
00545
00546
00547
00548
00549
00550
00551
00552
00553
00554
00555
00556
00557
00558
00559
00560
00561
00562
00563
00564
00565
00566
00567
00568
00569
00570
00571
00572
00573
00574
00575
00576
00577
00578
00579
00580
00581
00582
00583
00584
00585
00586
00587
00588
00589
00590
00591
00592
00593
00594
00595
00596
00597
00598
00599
00600
00601
00602
00603
00604
00605
00606
00607
00608
00609
00610
00611
00612
00613
00614
00615
00616
00617
00618
00619
00620
00621
00622
00623
00624
00625
00626
00627
00628
00629
00630
00631
00632
00633
00634
00635
00636
00637
00638
00639
00640
00641
00642
00643
00644
00645
00646
00647
00648
00649
00650
00651
00652
00653
00654
00655
00656
00657
00658
00659
00660
00661
00662
00663
00664
00665
00666
00667
00668
00669
00670
00671
00672
00673
00674
00675
00676
00677
00678
00679
00680
00681
00682
00683
00684
00685
00686
00687
00688
00689
00690
00691
00692
00693
00694
00695
00696
00697
00698
00699
00700
00701
00702
00703
00704
00705
00706
00707
00708
class HavokVehicle extends Pawn
	native;

cpptext
{
#ifdef UNREAL_HAVOK

	// Actor interface.
	virtual bool HavokInitActor();
	virtual void HavokQuitActor();
	
	virtual void PostNetReceive();
    virtual void PostEditChange();
    
	virtual void setPhysics(BYTE NewPhysics, AActor *NewFloor, FVector NewFloorV);
	
	virtual void TickSimulated( FLOAT DeltaSeconds );
	virtual void TickAuthoritative( FLOAT DeltaSeconds );
	
	virtual void HavokPreStepCallback(FLOAT DeltaTime);
	
	virtual void RemakeVehicle();  // updates the internal Havok Raycast vehicle. Called by default in VehicleUpdateParams event, but you can call it whenever you change suspension params etc. No need to call this if you just chaneg steering + throtle in the UpdateVehicle event.
	virtual void BuildVehicle();    // constructs the vehicle, internal call from PostBeginPlay

	virtual void syncVehicleToBones();
	
#endif
}

var const transient int hkVehicleDataPtr; //the HavokVehicleData pointer for this vehicle (stores the couple of Havok ptrs required to interface with the Havok SDK)

var (HavokVehicle) editinline array<HavokVehicleWheel>		Wheels; // Wheel data
var (HavokVehicle) editinline array<float>					GearRatios; //1 per gear, just add another value to get more gears. Gear ratios (3 == low speed, 0.5 == high speed)

// generic controls (set by controller, used by concrete derived classes)
var (HavokVehicle) float    Steering; // between -1 and 1
var (HavokVehicle) float    Throttle; // between -1 and 1
var (HavokVehicle) float	Rise;	  // between -1 and 1

var			   Pawn				Driver;

var (HavokVehicle) array<vector>	ExitPositions;		// Positions (rel to vehicle) to try putting the player when exiting.
var (HavokVehicle) array<vector>	EntryPositions;		// Positions (rel to vehicle) to create triggers for entry.

var (HavokVehicle) vector	DrivePos;		// Position (rel to vehicle) to put player while driving.
var (HavokVehicle) rotator	DriveRot;		// Rotation (rel to vehicle) to put driver while driving.
var (HavokVehicle) name		DriveAnim;		// Animation to play while driving.

//// CAMERAS ////
var (HavokVehicle) bool		bDrawMeshInFP;		// Whether to draw the vehicle mesh when in 1st person mode.
var	(HavokVehicle) bool		bDrawDriverInTP;	// Whether to draw the driver when in 3rd person mode.
var (HavokVehicle) bool		bZeroPCRotOnEntry;	// If true, set camera rotation to zero on entering vehicle. If false, set it to the vehicle rotation.

var (HavokVehicle) vector   FPCamPos;	// Position of camera when driving first person.

var (HavokVehicle) vector   TPCamLookat;
var (HavokVehicle) float    TPCamDistance;

var (HavokVehicle) int		MaxViewYaw; // Maximum amount you can look left and right
var (HavokVehicle) int		MaxViewPitch; // Maximum amount you can look up and down 

//// PHYSICS ////
var (HavokVehicleGeneral) float		ChassisMass; //kg, 750;
var (HavokVehicleGeneral) float		SteeringMaxAngle;  //~3000 Unreal units, (in Havok it hkMath::HK_REAL_PI / 10.0f);
var (HavokVehicleGeneral) float		MaxSpeedFullSteeringAngle; //kph  (130.0f * (1.605f / 3.6f)) by default;
var (HavokVehicleGeneral) float		FrictionEqualizer; //0.5f; 
var (HavokVehicleGeneral) float		TorqueRollFactor; //0.25f; 
var (HavokVehicleGeneral) float		TorquePitchFactor; // 0.5f; 
var (HavokVehicleGeneral) float		TorqueYawFactor; //0.35f; 
var (HavokVehicleGeneral) float		TorqueExtraFactor; //-0.5f; 
var (HavokVehicleGeneral) float		ChassisUnitInertiaYaw; //1.0f; 
var (HavokVehicleGeneral) float		ChassisUnitInertiaRoll; //0.4f; 
var (HavokVehicleGeneral) float		ChassisUnitInertiaPitch; //1.0f; 

	// Engine Performance
var (HavokVehicleEngine) float		EngineTorque; //500.0f;
var (HavokVehicleEngine) float		EngineMinRPM; //1000.0f;
var (HavokVehicleEngine) float		EngineOptRPM; // 5500.0f;
var (HavokVehicleEngine) float		EngineMaxRPM; //7500.0f;
var (HavokVehicleEngine) float		EngineTorqueFactorAtMinRPM; // 0.8f;
var (HavokVehicleEngine) float		EngineTorqueFactorAtMaxRPM; // 0.8f;
var (HavokVehicleEngine) float		EngineResistanceFactorAtMinRPM; // 0.05f;
var (HavokVehicleEngine) float		EngineResistanceFactorAtOptRPM; // 0.1f;
var (HavokVehicleEngine) float		EngineResistanceFactorAtMaxRPM; // 0.3f;
var (HavokVehicleEngine) float		GearDownshiftRPM; //3500.0f;
var (HavokVehicleEngine) float		GearUpshiftRPM; // 6500.0f;
var (HavokVehicleEngine) float		GearClutchDelayTime; //0.0f;
var (HavokVehicleEngine) float		GearReverseRatio; //1.0f;
var (HavokVehicleEngine) float		TopSpeed; 	// 130
	
	// Aerodynamics
var (HavokVehicleAerodynamics) float	AerodynamicsAirDensity; // 1.3f
var (HavokVehicleAerodynamics) float	AerodynamicsFrontalArea; // 1 (m^2)
var (HavokVehicleAerodynamics) float	AerodynamicsDragCoeff; //0.7f;
var (HavokVehicleAerodynamics) float	AerodynamicsLiftCoeff; //-0.3f;
var (HavokVehicleAerodynamics) vector	ExtraGravity; // 0,0,-5
var (HavokVehicleAerodynamics) float	SpinDamping; //1.0f; 
var (HavokVehicleAerodynamics) float	CollisionSpinDamping; // 0.0f;
var (HavokVehicleAerodynamics) float	CollisionThreshold; //4.0f; 


//// EFFECTS ////

// Effect spawned when vehicle is destroyed
var (HavokVehicle) class<Actor>	DestroyEffectClass;

// Created in PostNetBeginPlay and destroyed when vehicle is.
#if !IG_TRIBES3	// rowan: don't support HavokVehicleTrigger, as they are based of old AIScript class
var			   array<HavokVehicleTrigger>	EntryTriggers;
#endif

var			   bool     bGetOut;

// The factory that created this vehicle.
var			   HavokVehicleFactory	ParentFactory;

// Shadow projector
var			   ShadowProjector	VehicleShadow;

struct native HavokCarState
{
	var HavokRigidBodyState ChassisState;

	var float				ServerHandbrake;
	var float				ServerBrake;
	var float				ServerGas;
	var int					ServerGear;
	var	float				ServerSteering;

	var int					bNewState; // bools inside structs == scary!
};

var		HavokCarState			CarState;
var		bool					bNewCarState;

replication
{
	reliable if(Role==ROLE_Authority)
		ClientDriverEnter, ClientDriverLeave;

	unreliable if(Role == ROLE_Authority)
		CarState;
}

// Useful function for plotting data to real-time graph on screen.
native final function GraphData(string DataName, float DataValue);


// Really simple at the moment!
function PostTakeDamage(float Damage, Pawn instigatedBy, Vector hitlocation, 
						Vector momentum, class<DamageType> damageType, optional float projectileFactor)
{
	local PlayerController pc;

	Health -= Damage;

	Log("Ouch! "$Health);

	// The vehicle is dead!
	if(Health <= 0)
	{
		if ( Controller != None )
		{
			pc = PlayerController(Controller);

			if( Controller.bIsPlayer && pc != None )
			{
				ClientDriverLeave(pc); // Just to reset HUD etc.

				// THIS WAS HOW IT WAS IN UT2003, DONT KNOW ABOUT WARFARE...
				// pc.PawnDied(self); // This should unpossess the controller and let the player respawn
			}
			else
#if IG_TRIBES3
				Controller.PawnDied(self);
#else
				Controller.Destroy();
#endif
		}

		Destroy(); // Destroy the vehicle itself (see Destroyed below)
	}

    unifiedAddImpulseAtPosition(momentum, hitlocation);
}

// Vehicles dont get telefragged.
event EncroachedBy( actor Other )
{
	Log("HavokVehicle("$self$") Encroached By: "$Other$".");
}

simulated function FaceRotation( rotator NewRotation, float DeltaTime )
{
	// Vehicles ignore 'face rotation'.
}

// You got some new info from the server (ie. the CarState has some new info).
event HavokVehicleStateReceived();

// Do script car model stuff here - in the UpdateVehicle you can change steering and throtle., if you change suspension sparams, number of wheels etc, call Remake
simulated event UpdateVehicle( float DeltaTime );

// Redo the vehicle params.. all of them:
native function RemakeVehicle();

// Do any general vehicle set-up when it gets spawned.
simulated function PostNetBeginPlay()
{
	local vector RotX, RotY, RotZ;
#if !IG_TRIBES3	// rowan: don't support HavokVehicleTrigger, as they are based of old AIScript class
	local int i;
	local HavokVehicleTrigger NewTrigger;
#endif
    Super.PostNetBeginPlay();

	if(Level.NetMode != NM_Client)
	{
	    GetAxes(Rotation,RotX,RotY,RotZ);

#if !IG_TRIBES3	// rowan: don't support HavokVehicleTrigger, as they are based of old AIScript class
		EntryTriggers.Length = EntryPositions.Length;

		for(i=0; i<EntryPositions.Length; i++)
		{
			// Create triggers for gettting into the hoverbike - only on the server
			NewTrigger = spawn(class'HavokVehicleTrigger', self,, Location + EntryPositions[i].X * RotX + EntryPositions[i].Y * RotY + EntryPositions[i].Z * RotZ);
			NewTrigger.SetBase(self);
			NewTrigger.SetCollision(true, false, false);

			EntryTriggers[i] = NewTrigger;
		}
#endif
	}

	// Make sure params are up to date? Should be anyway.
	// HavokVehicleHasChanged();
}

// Called when a parameter of the overall articulated actor has changed (like PostEditChange)
simulated event HavokVehicleHasChanged()
{
	RemakeVehicle();
}

///////////////////////////////////////////
/////////////// NETWORKING ////////////////
///////////////////////////////////////////

simulated event bool HavokUpdateState(out HavokRigidBodyState newState)
{
	// This should never get called on the server - but just in case!
	if(Role == ROLE_Authority || !bNewCarState)
		return false;

	newState = CarState.ChassisState;
	bNewCarState = false;

	return true; // Get Havok to update the chassis rb
	//return false;
}


// The pawn Driver has tried to take control of this vehicle
function TryToDrive(Pawn p)
{
	local Controller C;
	C = p.Controller;

    if ( (Driver == None) && (C != None) && C.bIsPlayer && !C.IsInState('PlayerDriving') && p.IsHumanControlled() )
	{        
		DriverEnter(p);
    }
}

// Events called on driver entering/leaving vehicle

simulated function ClientDriverEnter(PlayerController pc)
{
	log("Enter: "$pc.Pawn);

	//pc.myHUD.bCrosshairShow = false;
	//pc.myHUD.bShowWeaponInfo = false;
	//pc.myHUD.bShowPersonalInfo = false;
	//pc.myHUD.bShowPoints = false;

	pc.bBehindView = true;
	pc.bFixedCamera = false;
	pc.bFreeCamera = true;

	// Set rotation of camera when getting into vehicle based on bZeroPCRotOnEntry
	if(	bZeroPCRotOnEntry )
		pc.SetRotation( rot(0, 0, 0) );
	else
		pc.SetRotation( rotator( vect(1, 0, 0) >> Rotation ) );
}

function DriverEnter(Pawn p)
{
	local PlayerController pc;
	local vector AttachPos;

    log("HavokVehicle DriverEnter");

	// Set pawns current controller to control the vehicle pawn instead
	Driver = p;

	// Move the driver into position, and attach to car.
	Driver.SetCollision(false, false, false);
	Driver.bCollideWorld = false;
	Driver.bPhysicsAnimUpdate = false;
	Driver.Velocity = vect(0,0,0);
//	Driver.SetPhysics(PHYS_None);

	AttachPos = Location + (DrivePos >> Rotation);
	Driver.SetLocation(AttachPos);

	Driver.SetPhysics(PHYS_None);

	Driver.bHardAttach = true;
	Driver.SetBase(None);
	Driver.SetBase(self);
	Driver.SetRelativeRotation(DriveRot);
	Driver.SetPhysics(PHYS_None);

	pc = PlayerController(p.Controller);
	//pc.ClientSetBehindView(true);
	//pc.ClientSetFixedCamera(false);

	// Disconnect PlyaerController from Driver and connect to HavokVehicle.
	pc.Unpossess();
	Driver.SetOwner(self); // This keeps the driver relevant.
	pc.Possess(self);

	pc.ClientSetViewTarget(self); // Set playercontroller to view the vehicle

	// Change controller state to driver
    pc.GotoState('PlayerDriving');

	ClientDriverEnter(pc);
}

simulated function ClientDriverLeave(PlayerController pc)
{
	//local vector exitLookDir;

	log("Leave: "$pc.Pawn);

	//pc.bBehindView = false;
	pc.bFixedCamera = true;
	pc.bFreeCamera = false;

	// Stop messing with bOwnerNoSee
	Driver.bOwnerNoSee = Driver.default.bOwnerNoSee;

	// This removes any 'roll' from the look direction.
	//exitLookDir = Vector(pc.Rotation);
	//pc.SetRotation(Rotator(exitLookDir));

    //pc.myHUD.bCrosshairShow = pc.myHUD.default.bCrosshairShow;
	//pc.myHUD.bShowWeaponInfo = pc.myHUD.default.bShowWeaponInfo;
	//pc.myHUD.bShowPersonalInfo = pc.myHUD.default.bShowPersonalInfo;
	//pc.myHUD.bShowPoints = pc.myHUD.default.bShowPoints;
}

// Called from the PlayerController when player wants to get out.
function bool DriverLeave(bool bForceLeave)
{
	local PlayerController pc;
	local int i;
	local bool havePlaced;
	local vector HitLocation, HitNormal, tryPlace;

    log("HavokVehicle DriverLeave");

	// Do nothing if we're not being driven
	if(Driver == None)
		return false;

	// Before we can exit, we need to find a place to put the driver.
	// Iterate over array of possible exit locations.
	
	Driver.bHardAttach = false;
	Driver.bCollideWorld = true;
	Driver.SetCollision(true, true, true);
	
	havePlaced = false;
	for(i=0; i < ExitPositions.Length && havePlaced == false; i++)
	{
		//Log("Trying Exit:"$i);
	
		tryPlace = Location + (ExitPositions[i] >> Rotation);
	
		// First, do a line check (stops us passing through things on exit).
		if( Trace(HitLocation, HitNormal, tryPlace, Location, false) != None )
			continue;
			
		// Then see if we can place the player there.
		if( !Driver.SetLocation(tryPlace) )
			continue;
		
		havePlaced = true;
		
		//Log("SUCCESS!");		
	}

	// If we could not find a place to put the driver, leave driver inside as before.
	if(!havePlaced && !bForceLeave)
	{
		Log("Could not place driver.");
	
		Driver.bHardAttach = true;
		Driver.bCollideWorld = false;
		Driver.SetCollision(false, false, false);
	
		return false;
	}

	pc = PlayerController(Controller);

	ClientDriverLeave(pc);

	// Reconnect PlayerController to Driver.
	pc.Unpossess();
	Driver.SetOwner(pc);
	pc.Possess(Driver);

	pc.ClientSetViewTarget(Driver); // Set playercontroller to view the persone that got out

	Controller = None;

	Driver.PlayWaiting();
	Driver.bPhysicsAnimUpdate = Driver.Default.bPhysicsAnimUpdate;

	// Do stuff on client
	//pc.ClientSetBehindView(false);
	//pc.ClientSetFixedCamera(true);

    Driver.Acceleration = vect(0, 0, 24000);
	Driver.SetPhysics(PHYS_Falling);
	Driver.SetBase(None);

	// Car now has no driver
	Driver = None;

	// Put brakes on before you get out :)
    Throttle=0;
    Steering=0;
	Rise=0;
    
    return true;
}

simulated function Destroyed()
{
#if !IG_TRIBES3
	local int i;
#endif

	Log("HavokVehicle Destroyed");

	// Destroy the triggers used for getting in.
#if !IG_TRIBES3	// rowan: don't support HavokVehicleTrigger, as they are based of old AIScript class
	for(i=0; i<EntryTriggers.Length; i++)
	{
		if(EntryTriggers[i] != None)
			EntryTriggers[i].Destroy();
	}
#endif

	// If there was a driver in the vehicle, destroy him too
	if(Driver != None)
		Driver.Destroy();

	// Decrease number of cars active out of parent factory
	if(ParentFactory != None)
		ParentFactory.VehicleCount--;

	// Trigger any effects for destruction
	if(DestroyEffectClass != None)
		spawn(DestroyEffectClass, , , Location, Rotation);

	// Destroy shadow projector
    if (VehicleShadow != None) 
		VehicleShadow.Destroy();

	Super.Destroyed();
}

// Just to intercept 'getting out' request.
simulated event Tick(float deltaSeconds)
{
	local bool gotOut;

	if(bGetOut && ROLE==Role_Authority)
	{
		gotOut = DriverLeave(false);
		if(!gotOut )
		{
			Log("Couldn't Leave - staying in!");
		}
	}
	bGetOut = false;
}

// This will get called if we couldn't move a pawn out of the way. 
function bool EncroachingOn( actor Other )
{
	if ( Other == None )
		return false;

	// If its a non-vehicle pawn, do lots of damage.
	if( Pawn(Other) != None && HavokVehicle(Other) == None )
	{
		Other.TakeDamage(10000, None, Other.Location, vect(0,0,0), class'Crushed');
		return false;
	}
}

// Glue a shadow projector on
simulated function PostBeginPlay()
{
    Super.PostBeginPlay();

    if (Level.NetMode != NM_DedicatedServer)
    {
        VehicleShadow = Spawn(class'ShadowProjector', self, '', Location);
        VehicleShadow.ShadowActor = self;
        VehicleShadow.bBlobShadow = false;
        VehicleShadow.LightDirection = Normal(vect(1,1,6));
        VehicleShadow.LightDistance = 1200;
        VehicleShadow.MaxTraceDistance = 350;
        VehicleShadow.InitShadow();
    }
}

// Special calc-view for vehicles
simulated function bool SpecialCalcView(out actor ViewActor, out vector CameraLocation, out rotator CameraRotation )
{
	local vector CamLookAt, HitLocation, HitNormal, OffsetVector;
	local PlayerController pc;
	local quat CarQuat, LookQuat, ResultQuat;

	pc = PlayerController(Controller);

	// Only do this mode we have a playercontroller viewing this vehicle
	if(pc == None || pc.ViewTarget != self)
		return false;

	if(pc.bBehindView) ///// THIRD PERSON ///////
	{
		ViewActor = self;
		CamLookAt = Location + (TPCamLookat >> Rotation); 

		OffsetVector = vect(0, 0, 0);
		OffsetVector.X = -1.0 * TPCamDistance;

		CameraLocation = CamLookAt + (OffsetVector >> CameraRotation);

		if( Trace( HitLocation, HitNormal, CameraLocation, CamLookAt, false, vect(10, 10, 10) ) != None )
		{
			CameraLocation = HitLocation;
		}

		bOwnerNoSee = false;

		if(bDrawDriverInTP)
			Driver.bOwnerNoSee = false;
		else
			Driver.bOwnerNoSee = true;
	}
	else ////// FIRST PERSON //////
	{
		ViewActor = self;

		// Camera position is locked to car
		CameraLocation = Location + (FPCamPos >> Rotation);

		//Log(CameraRotation);
		CarQuat = QuatFromRotator(Rotation);

		// Limit where you can look while driving.

		Normalize(CameraRotation); // Puts each element between +/- 32767

		if(CameraRotation.Yaw > MaxViewYaw)
			CameraRotation.Yaw = MaxViewYaw;
		else if(CameraRotation.Yaw < -MaxViewYaw)
			CameraRotation.Yaw = -MaxViewYaw;

		//if(CameraRotation.Pitch > MaxViewPitch)
		//	CameraRotation.Pitch = MaxViewPitch;
		//else if(CameraRotation.Pitch < -MaxViewPitch)
		//	CameraRotation.Pitch = -MaxViewPitch;

		//pc.DesiredRotation = CameraRotation;
		//pc.SetRotation(CameraRotation);

		LookQuat = QuatFromRotator(CameraRotation);
		ResultQuat = QuatProduct(LookQuat, CarQuat);
		CameraRotation = QuatToRotator(ResultQuat);

		if(bDrawMeshInFP)
			bOwnerNoSee = false;
		else
			bOwnerNoSee = true;

		Driver.bOwnerNoSee = true; // In first person, dont draw the driver
	}

	return true;
}

defaultproperties
{
    Steering=0
    Throttle=0
	Rise=0
	
	//ExitPositions(0)=(X=0,Y=0,Z=0)	
    ExitPositions(0)=(Y=-315.000000,Z=100.000000)
    ExitPositions(1)=(Y=315.000000,Z=100.000000)
    ExitPositions(2)=(Y=0.000000,Z=-400.000000)
    ExitPositions(3)=(Y=0.000000,Z=400.000000)
    EntryPositions(0)=(Y=265.000000,Z=10.000000)
    EntryPositions(1)=(Y=-265.000000,Z=10.000000)
    
 	bDrawDriverInTP=false
	bDrawMeshInFP=true

	DrivePos=(X=0,Y=0,Z=0)
	bZeroPCRotOnEntry=true

	TPCamLookat=(X=-100,Y=0,Z=100)
	TPCamDistance=600

	MaxViewYaw=16000
	MaxViewPitch=16000

    Physics=PHYS_Havok
	bEdShouldSnap=True
	bStatic=False
	bShadowCast=False
	bCollideActors=True
	bCollideWorld=False
    bProjTarget=True
	bBlockActors=True
	bBlockNonZeroExtentTraces=True
	bBlockZeroExtentTraces=True
	bBlockPlayers=True
	bWorldGeometry=False
	bBlockKarma=False
	bBlockHavok=True
    CollisionHeight=+000001.000000
	CollisionRadius=+000001.000000
	bAcceptsProjectors=True
	bCanBeBaseForPawns=True
	bAlwaysRelevant=True
	RemoteRole=ROLE_SimulatedProxy
	bNetInitialRotation=True
	bSpecialCalcView=True
	//bSpecialHUD=true
	
	// Chassis
	ChassisMass=750 //kg, 750;
	SteeringMaxAngle=4000 // hkMath::HK_REAL_PI / 10.0f or so;
	MaxSpeedFullSteeringAngle=70 //kph  (130.0f * (1.605f / 3.6f)) by default in a lot of Havok demos;
	FrictionEqualizer=0.5
	TorqueRollFactor=0.25
	TorquePitchFactor=0.5
	TorqueYawFactor=0.35 
	TorqueExtraFactor=-0.5
	ChassisUnitInertiaYaw=1.0
	ChassisUnitInertiaRoll=0.4
	ChassisUnitInertiaPitch=1.0

	// Engine Performance
	EngineTorque=500
	EngineMinRPM=1000
	EngineOptRPM=5500
	EngineMaxRPM=7500
	EngineTorqueFactorAtMinRPM=0.8
	EngineTorqueFactorAtMaxRPM=0.8
	EngineResistanceFactorAtMinRPM=0.05
	EngineResistanceFactorAtOptRPM=0.1
	EngineResistanceFactorAtMaxRPM=0.3
	GearDownshiftRPM=3500
	GearUpshiftRPM=6500
	GearClutchDelayTime=0
	GearReverseRatio=1
	TopSpeed=130
	
	// Aerodynamics
	AerodynamicsAirDensity=1.3
	AerodynamicsFrontalArea=1
	AerodynamicsDragCoeff=0.7
	AerodynamicsLiftCoeff=-0.3
	ExtraGravity=(X=0,Y=0,Z=-5)
	SpinDamping=1
	CollisionSpinDamping=0
	CollisionThreshold=4
	
	// At least one gear, straight ratio of 1 
	GearRatios(0)=1
	
	Texture=Texture'Engine_res.Havok.S_HkVehicle'
	
}

Overview Package Class Source Class tree Glossary
previous class      next class frames      no frames
Class file time: ne 5.9.2004 16:01:22.000 - Creation time: st 23.5.2018 00:10:44.119 - Created with UnCodeX