Always snap to grid
UE2:Vehicle (UT2004)
Contents
- 1 Properties
- 1.1 Property group 'Vehicle'
- 1.1.1 bDrawDriverInTP
- 1.1.2 bDrawMeshInFP
- 1.1.3 bDriverCollideActors
- 1.1.4 bFPNoZFromCameraPitch
- 1.1.5 bHighScoreKill
- 1.1.6 bHUDTrackVehicle
- 1.1.7 bRelativeExitPos
- 1.1.8 BulletSounds
- 1.1.9 bZeroPCRotOnEntry
- 1.1.10 DriveAnim
- 1.1.11 DrivePos
- 1.1.12 DriveRot
- 1.1.13 EntryPosition
- 1.1.14 EntryRadius
- 1.1.15 ExitPositions
- 1.1.16 FPCamPos
- 1.1.17 FPCamViewOffset
- 1.1.18 HUDOverlayFOV
- 1.1.19 HUDOverlayOffset
- 1.1.20 MaxViewPitch
- 1.1.21 MaxViewYaw
- 1.1.22 Rise
- 1.1.23 SpawnOverlay
- 1.1.24 Steering
- 1.1.25 Team
- 1.1.26 Throttle
- 1.1.27 TPCamDistRange
- 1.1.28 TPCamLookat
- 1.1.29 TPCamWorldOffset
- 1.1.30 WaterDamage
- 1.2 Internal variables
- 1.3 Default values
- 1.1 Property group 'Vehicle'
- 2 Structs
- 3 Functions
- 3.1 Static functions
- 3.2 Native code
- 3.3 Events
- 3.3.1 Destroyed
- 3.3.2 DrivingStatusChanged
- 3.3.3 EncroachedBy
- 3.3.4 EncroachingOn
- 3.3.5 IsVehicleEmpty
- 3.3.6 KDriverLeave
- 3.3.7 LockOnWarning
- 3.3.8 NeedsFlip
- 3.3.9 NotifyEnemyLockedOn
- 3.3.10 NotifyEnemyLostLock
- 3.3.11 PlayDying
- 3.3.12 PostBeginPlay
- 3.3.13 PreBeginPlay
- 3.3.14 RanInto
- 3.3.15 SetAnimAction
- 3.3.16 SetInitialState
- 3.3.17 SetWheelsScale
- 3.3.18 Stalled
- 3.3.19 TakeDamage
- 3.3.20 TakeWaterDamage
- 3.3.21 TeamChanged
- 3.3.22 UnStalled
- 3.3.23 UpdateEyeHeight
- 3.3.24 UpdateTiltForceFeedback
- 3.3.25 UsedBy
- 3.3.26 VehicleLocked
- 3.3.27 VerifyLock
- 3.4 Other instance functions
- 4 States
- Package:
- Engine
- Direct subclasses:
- ASVehicle, KVehicle, ONSWeaponPawn, SVehicle
- This class in other games:
- UE2Runtime, U2XMP, UT2003, U2, UDK, UT3
Please help improve this article or section by expanding it. |
This abstract base class contains gameplay and AI code for vehicles
Properties[edit]
Property group 'Vehicle'[edit]
bDrawDriverInTP[edit]
Type: bool
Whether to draw the driver when in 3rd person mode.
bDrawMeshInFP[edit]
Type: bool
Whether to draw the vehicle mesh when in 1st person mode.
bDriverCollideActors[edit]
Type: bool
"If driver is drawn in vehicle, is Driver.bCollideActors true?", asked the programmer. In fact, this variable is used nowhere else in UnrealScript.
bFPNoZFromCameraPitch[edit]
Type: bool
Ignore any vehicle-space Z due to FPCamViewOffset (so looking up and down doesn't change camera Z rel to vehicle)
bHighScoreKill[edit]
Type: bool
Vehicle is considered important, and awards 5 points upon destruction.
bHUDTrackVehicle[edit]
Type: bool
If true, Vehicle will be tracked on HUD. (This may be used if the vehicle is an Objective in Assault)
bRelativeExitPos[edit]
Type: bool
relative vector to vehicle?
Default value: True
BulletSounds[edit]
This array stores a row of sounds from which one is chosen randomly to play if the vehicle is hit by a bullet-type weapon. 16 sounds are set in the ONSVehicle class.
bZeroPCRotOnEntry[edit]
Type: bool
If true, set camera rotation to zero on entering vehicle. If false, set it to the vehicle rotation.
Default value: True
DriveAnim[edit]
Type: name
The pose that is used by the driver if he's drawn in the vehicle.
Default value: 'Vehicle_Driving'
DrivePos[edit]
Type: Object.Vector
Position (relative to vehicle) to put player while driving.
Default value:
Member | Value |
---|---|
X | 0.0 |
Y | 0.0 |
Z | 0.0 |
DriveRot[edit]
Type: Object.Rotator
Rotation (relative to vehicle) to put driver while driving.
EntryPosition[edit]
Type: Object.Vector
Offset for the entry trigger
Default value:
Member | Value |
---|---|
X | 0.0 |
Y | 0.0 |
Z | 0.0 |
EntryRadius[edit]
Type: float
Radius for the entry trigger
Default value: 100.0
ExitPositions[edit]
Type: array<Object.Vector>
Positions (relative to vehicle) to try putting the player when exiting.
Default value:
Member | Value |
---|---|
X | 0.0 |
Y | 0.0 |
Z | 0.0 |
FPCamPos[edit]
Type: Object.Vector
Position of camera when driving first person.
FPCamViewOffset[edit]
Type: Object.Vector
HUDOverlayFOV[edit]
Type: float
The FOV with which you will look at the rendered HUDOVerlay actor.
HUDOverlayOffset[edit]
Type: Object.Vector
How far the HUDOverlay actor is away from the perspective of the player.
MaxViewPitch[edit]
Type: int
Maximum amount you can look up and down
Default value: 16000
MaxViewYaw[edit]
Type: int
Maximum amount you can look left and right
Default value: 16000
Rise[edit]
Type: float
Between -1 and 1
SpawnOverlay[edit]
Type: Material
Array size: 2
The texture that is shown on the vehicle when it spawns. The index 0 stores the overlay texture for the red team, 1 for the blue team.
Steering[edit]
Type: float
between -1 and 1
Team[edit]
Type: byte
To which team does this vehicle belong. 0 = red; 1 = blue; 255 = neutral/none.
Default value: 255
Throttle[edit]
Type: float
between -1 and 1
TPCamDistRange[edit]
Type: Object.Range
How close can the third person camera be zoomed to the vehicle before it switches to first person cam and how far can it be zoomed away from the vehicle.
Default value:
Member | Value |
---|---|
Max | 1500.0 |
Min | 50.0 |
TPCamLookat[edit]
Type: Object.Vector
Look at location in vehicle space
Default value:
Member | Value |
---|---|
X | -100.0 |
Y | 0.0 |
Z | 100.0 |
TPCamWorldOffset[edit]
Type: Object.Vector
Applied in world space after vehicle transform.
Default value:
Member | Value |
---|---|
X | 0.0 |
Y | 0.0 |
Z | 0.0 |
WaterDamage[edit]
Type: float
How much damage does the vehicle take per second if it's in a WaterVolume with bDamageVehicle = true.
Internal variables[edit]
See Vehicle internal variables.
Default values[edit]
Property | Value |
---|---|
bCanBeBaseForPawns | True |
bDontPossess | True |
bForceSkelUpdate | True |
bUseCompressedPosition | False |
CollisionHeight | 50.0 |
CollisionRadius | 120.0 |
CrouchedPct | 1.0 |
LandMovementState | 'PlayerDriving' |
NetPriority | 1.0 |
NetUpdateFrequency | 4.0 |
SightRadius | 15000.0 |
WalkingPct | 1.0 |
Structs[edit]
SVehicleIcon[edit]
Modifiers: native
Functions[edit]
Static functions[edit]
StaticPrecache[edit]
Overrides: Pawn.StaticPrecache
Native code[edit]
Team beacon drawing[edit]
void AVehicle::PostRender(FLevelSceneNode* SceneNode, FRenderInterface* RI) { guard(AVehicle::PostRender); // Render team beacon if ( !SceneNode || !SceneNode->Viewport || !SceneNode->Viewport->Actor ) return; if ( bScriptPostRender ) { FVector camLoc = SceneNode->WorldToCamera.TransformFVector(Location + FVector(0.f,0.f,CollisionHeight)); FPlane screenLoc = SceneNode->Project(SceneNode->CameraToWorld.TransformFVector(camLoc)); screenLoc.X = (SceneNode->Viewport->Canvas->ClipX * 0.5f * (screenLoc.X + 1.f)); screenLoc.Y = (SceneNode->Viewport->Canvas->ClipY * 0.5f * (-screenLoc.Y + 1.f)); eventPostRender2D(SceneNode->Viewport->Canvas,screenLoc.X, screenLoc.Y); return; } if ( bNoTeamBeacon || ((SceneNode->Viewport->Actor->ViewTarget == this) && (SceneNode->Viewport->Actor->Pawn == this)) ) return; APlayerController* pc = SceneNode->Viewport->Actor; UBOOL bSpectating = pc->PlayerReplicationInfo ? (pc->PlayerReplicationInfo->bOnlySpectator && !pc->bHideSpectatorBeacons) : false; INT playerTeamIndex = -1; // Draw 'No Entry' indicator. if ( !bSpectating && !SceneNode->Viewport->Actor->bHideVehicleNoEntryIndicator ) { if (pc->PlayerReplicationInfo && pc->PlayerReplicationInfo->Team) playerTeamIndex = pc->PlayerReplicationInfo->Team->TeamIndex; if (playerTeamIndex < 0 || playerTeamIndex > 1) return; if ( bTeamLocked && (playerTeamIndex != Team) && !PlayerReplicationInfo ) { FLOAT actorDist = SceneNode->WorldToScreen.TransformFVector(Location).Z; if ( (actorDist < 0.f) || (actorDist > 2.f * pc->TeamBeaconPlayerInfoMaxDist) || !NoEntryTexture ) return; FCheckResult Hit(1.f); GetLevel()->SingleLineCheck( Hit, this, Location, SceneNode->ViewOrigin, TRACE_World|TRACE_StopAtFirstHit ); if ( Hit.Actor ) { GetLevel()->SingleLineCheck( Hit, this, Location + FVector(0.f,0.f,0.5f*CollisionHeight), SceneNode->ViewOrigin, TRACE_World|TRACE_StopAtFirstHit ); if ( Hit.Actor ) return; } GetLevel()->SingleLineCheck( Hit, pc->Pawn, Location, SceneNode->ViewOrigin, TRACE_Pawns ); if ( Hit.Actor && (Hit.Actor != this) && !Hit.Actor->bWorldGeometry ) { if ( Hit.Actor->Physics == PHYS_Karma ) return; FVector Projected = (Hit.Actor->Location - Hit.Location); FVector ViewDir = (Hit.Actor->Location - SceneNode->ViewOrigin).SafeNormal(); Projected = Projected - ViewDir * (ViewDir | Projected); if ( Abs(Projected.Z) < 0.8f * Hit.Actor->CollisionHeight ) return; Projected.Z = 0.f; if ( Projected.SizeSquared() < 0.25f * Hit.Actor->CollisionRadius * Hit.Actor->CollisionRadius ) return; } // draw locked symbol FVector camLoc = SceneNode->WorldToCamera.TransformFVector(Location); FPlane screenLoc = SceneNode->Project(SceneNode->CameraToWorld.TransformFVector(camLoc)); SceneNode->Viewport->Canvas->Style = STY_AlphaZ; FLOAT xscale = ::Clamp( (2.f*pc->TeamBeaconPlayerInfoMaxDist - actorDist)/(2.f*pc->TeamBeaconPlayerInfoMaxDist), 0.55f, 1.f); xscale = xscale * xscale; screenLoc.X = (SceneNode->Viewport->Canvas->ClipX * 0.5f * (screenLoc.X + 1.f)) - 0.5*NoEntryTexture->USize*xscale; screenLoc.Y = (SceneNode->Viewport->Canvas->ClipY * 0.5f * (-screenLoc.Y + 1.f)) - 0.5*NoEntryTexture->VSize*xscale; SceneNode->Viewport->Canvas->DrawTile( NoEntryTexture, screenLoc.X, screenLoc.Y, NoEntryTexture->USize*xscale, NoEntryTexture->VSize*xscale, 0.f, 0.f, NoEntryTexture->USize, NoEntryTexture->VSize, 0.f, FPlane(1.f,0.f,0.f,1.f), FPlane(0.0f,0.0f,0.0f,0.0f)); return; } } INT teamIndex = -1; if (PlayerReplicationInfo && PlayerReplicationInfo->Team) teamIndex = PlayerReplicationInfo->Team->TeamIndex; else teamIndex = Team; if ( teamIndex == -1 ) return; if ( !bSpectating && (teamIndex != playerTeamIndex) ) return; UTexture* teamBeacon = TeamBeaconTexture; UMaterial* teamBeaconBorder = TeamBeaconBorderMaterial; if ( !teamBeacon ) { if ( !bDrawDriverInTP || (Driver && ((Location - SceneNode->ViewOrigin).SizeSquared() > Square(Driver->CullDistance))) ) Super::PostRender(SceneNode,RI); return; } FLOAT actorDist = pc->FOVBias * SceneNode->WorldToScreen.TransformFVector(Location).Z; FLOAT ScaledDist = pc->TeamBeaconMaxDist * ::Clamp(0.04f * CollisionRadius,1.f,3.f); if ( (actorDist < 0.f) || (actorDist > ScaledDist) ) return; if (!pc->LineOfSightTo(this)) return; FPlane color = (teamIndex == 0) ? FPlane(1.f,0.25f,0.25f,1.f) : FPlane(0.25f,0.35f,1.f,1.f); if ( teamIndex > 1 ) color = (teamIndex == 2) ? FPlane(0.f,1.f,0.25f,1.f) : FPlane(1.f,1.f,0.f,1.f); FVector camLoc = SceneNode->WorldToCamera.TransformFVector(Location+FVector(0.0f,0.0f,1.75f * CollisionHeight)); FPlane screenLoc = SceneNode->Project(SceneNode->CameraToWorld.TransformFVector(camLoc)); SceneNode->Viewport->Canvas->Style = STY_AlphaZ; FLOAT xscale = ::Clamp( (pc->TeamBeaconMaxDist - actorDist)/pc->TeamBeaconMaxDist, 0.7f, 1.f); xscale = xscale * xscale * 0.5f; if ( actorDist < 10.f*CollisionRadius) xscale *= 3.f * ::Max( 0.333f, (10.f*CollisionRadius - actorDist)/(10.f*CollisionRadius)); else if ( actorDist > 1.5f * pc->TeamBeaconMaxDist ) xscale *= ::Max( 0.5f, (ScaledDist - actorDist)/(ScaledDist - 1.5f * pc->TeamBeaconMaxDist)); FLOAT yscale = 0.25f * xscale; screenLoc.X = (SceneNode->Viewport->Canvas->ClipX * 0.5f * (screenLoc.X + 1.f)) - 0.5*teamBeacon->USize*xscale; screenLoc.Y = (SceneNode->Viewport->Canvas->ClipY * 0.5f * (-screenLoc.Y + 1.f)) - 0.5*teamBeacon->VSize*xscale; if ( !bHUDTrackVehicle ) { if ( teamBeaconBorder ) { SceneNode->Viewport->Canvas->DrawTile( teamBeaconBorder, screenLoc.X, screenLoc.Y, teamBeacon->USize*xscale, teamBeacon->VSize*yscale, 0.f, 0.f, teamBeacon->USize, teamBeacon->VSize, 0.f, FPlane(1.f,1.f,1.f,1.f), FPlane(0.0f,0.0f,0.0f,0.0f)); } if ( teamBeacon ) { FPlane HealthColor; if (Health / HealthMax > 0.5) { HealthColor = FPlane(::Clamp(1.f - (HealthMax - (HealthMax - Health) * 2)/HealthMax,0.f,1.f), 1.f, 0.f, 1.f); } else { HealthColor = FPlane(1.f, ::Clamp(2.f*Health/HealthMax,0.f,1.f), 0.f, 1.f); } SceneNode->Viewport->Canvas->DrawTile( teamBeacon, screenLoc.X, screenLoc.Y, teamBeacon->USize*xscale * Health/HealthMax, teamBeacon->VSize*yscale, 0.f, 0.f, teamBeacon->USize, teamBeacon->VSize, 0.f, HealthColor, FPlane(0.0f,0.0f,0.0f,0.0f)); } } if ( PlayerReplicationInfo && (!bDrawDriverInTP || (Driver && ((Location - SceneNode->ViewOrigin).SizeSquared() > Square(Driver->CullDistance)))) ) { FLOAT xL, yL; FString info; UTexture* PCteamBeacon = pc->TeamBeaconTexture; if ( PCteamBeacon ) { //FLOAT xscale = Clamp(0.28f * (ScaledDist - actorDist)/ScaledDist,0.1f, 0.25f); if ( pc->myHUD && pc->myHUD->PortraitPRI && (pc->myHUD->PortraitPRI ==PlayerReplicationInfo) && pc->SpeakingBeaconTexture ) { teamBeacon = pc->SpeakingBeaconTexture; xscale = 3.f * Clamp(0.28f * (ScaledDist - actorDist)/ScaledDist,0.1f, 0.25f);; } screenLoc.X -= teamBeacon->USize*xscale; screenLoc.Y -= 0.5*teamBeacon->VSize*xscale; SceneNode->Viewport->Canvas->Style = STY_AlphaZ; SceneNode->Viewport->Canvas->DrawTile( PCteamBeacon, screenLoc.X, screenLoc.Y, PCteamBeacon->USize*xscale, PCteamBeacon->VSize*xscale, 0.f, 0.f, PCteamBeacon->USize, PCteamBeacon->VSize, 0.f, color, FPlane(0.0f,0.0f,0.0f,0.0f)); } if ( !GIsPixomatic && (actorDist < 2.f*pc->TeamBeaconPlayerInfoMaxDist) && (SceneNode->Viewport->Canvas->ClipX > 600) ) { if ( PlayerReplicationInfo->bBot ) info +=(PlayerReplicationInfo->eventGetNameCallSign()); else info +=(PlayerReplicationInfo->PlayerName); SceneNode->Viewport->Canvas->ClippedStrLen( SceneNode->Viewport->Canvas->SmallFont, 1.f, 1.f, xL, yL, *info); INT index = pc->PlayerNameArray.AddZeroed(); pc->PlayerNameArray(index).mInfo = info; pc->PlayerNameArray(index).mColor = color; pc->PlayerNameArray(index).mXPos = screenLoc.X; pc->PlayerNameArray(index).mYPos = screenLoc.Y - yL; } } unguard; }
Events[edit]
Destroyed[edit]
Overrides: Pawn.Destroyed
Vehicle notifies the ParentFactory of it's death, deletes it's ShadowProjector and Controllers of auto turrets and removes itself from the Level.Game.VehicleList
DrivingStatusChanged[edit]
Vehicle adjust it's bDropDetail value and enables the Tick if it's driven (or disables it if there is no driver anymore)
EncroachedBy[edit]
Overrides: Pawn.EncroachedBy
Overrides the super function with an empty one because vehicles can't get telefragged.
EncroachingOn[edit]
Overrides: Pawn.EncroachingOn
Called when the vehicle couldn't move a pawn out of it's way. If the pawn isn't a vehicle, then it will be crunched with a lot of damage, no matter if it's an enemy or not. The vehicle basically had no other choice.
IsVehicleEmpty[edit]
True if the vehicle has no driver.
KDriverLeave[edit]
Called by the driver who wants to get out. The vehicle tries to find a good exit position (if it finds none, the driver will stay inside). Then it places the driver outside, assign the Controller which was on the vehicle to the driver, gives the driver his flag if he carried it inside the vehicle and pulls the brakes on the vehicle before the driver gets out.
LockOnWarning[edit]
Displays a message for the player who tries to enter the locked vehicle. Repeats the message after a certain time if the player still doesn't get his hands off.
NeedsFlip[edit]
True, if the vehicle lies on it's back. This also takes the gravity direction of the map into account.
NotifyEnemyLockedOn[edit]
Sets bEnemyLockedOn to True.
NotifyEnemyLostLock[edit]
Sets bEnemyLockedOn to False.
PlayDying[edit]
Overrides: Pawn.PlayDying
Empty.
PostBeginPlay[edit]
Overrides: Pawn.PostBeginPlay
Assigns a shadow to the vehicle and sets a Controller if the vehicle is an auto turret.
PreBeginPlay[edit]
Overrides: Pawn.PreBeginPlay
Deletes the vehicle if no vehicles are allowed in the current gametype.
RanInto[edit]
Overrides: Actor.RanInto
Called for encroaching actors which successfully moved the other actor out of the way. Will move the encroaching non-vehicle pawn out of the way at low speed or deal a lot of damage at higher speed.
SetAnimAction[edit]
Overrides: Pawn.SetAnimAction
Calls the SetAnimAction of the driver and delegates the NewAction to it.
SetInitialState[edit]
Overrides: Actor.SetInitialState
Disables Tick at the beginning.
SetWheelsScale[edit]
Sets the WheelScale. Obviously.
Stalled[edit]
Sets bStalled to True if the vehicle is above the level's StallZ. A vehicle with bStalled can't apply acceleration any more.
TakeDamage[edit]
Overrides: Pawn.TakeDamage
Takes the vehicle's SpawnProtection into account and adjusts the caused damaged according to the damage type's VehicleDamageScaling and VehicleMomentumScaling. Also hurts the driver if that option is enables and kills or ejects him if the vehicle is killed.
TakeWaterDamage[edit]
Deals the WaterDamage to the vehicle. Also spawns some splashes if the vehicle is fast enough.
TeamChanged[edit]
Empty.
UnStalled[edit]
Sets bStalled to False if the vehicle fell below the StallZ again.
UpdateEyeHeight[edit]
Overrides: Pawn.UpdateEyeHeight
UpdateTiltForceFeedback[edit]
UsedBy[edit]
Overrides: Actor.UsedBy
Someone pressed the Use-button on this vehicle, try to let him drive if the driver seat isn't taken already.
VehicleLocked[edit]
Pawn tried to enter the vehicle, but it's locked. So call an event in C++ instead.
VerifyLock[edit]
Used to override locking actors. Returns who the aggressor really should lock on to.
Other instance functions[edit]
See Vehicle instance functions.
States[edit]
Deployed[edit]
Has no state code, only state functions.
Deployed.VehicleCeaseFire[edit]
Overrides: VehicleCeaseFire (global)
Calls the global version of this function.
Deployed.VehicleFire[edit]
Overrides: VehicleFire (global)
Calls the global version of this function.
UnDeployed[edit]
Has no state code, only state functions.
UnDeployed.VehicleCeaseFire[edit]
Overrides: VehicleCeaseFire (global)
Calls the global version of this function.
UnDeployed.VehicleFire[edit]
Overrides: VehicleFire (global)
Calls the global version of this function.