PlayerData

consoledoc.h

Defines properties for a Player object.

More...

Camera

The settings used by the shape when it is the camera.

bool

Flag controlling whether to render the player shape in first person view.

bool

Forces shadows to be rendered in first person when renderFirstPerson is disabled. Defaults to false.

float

Lowest angle (in radians) the player can look.

float

Highest angle (in radians) the player can look.

float

Defines the maximum left and right angles (in radians) the player can look in freelook mode.

Movement

float

Maximum height the player can step up.

float

Force used to accelerate the player when running.

float

Energy value drained each tick that the player is moving.

float

Minimum energy level required to run or swim.

float

Maximum forward speed when running.

float

Maximum backward speed when running.

float

Maximum sideways speed when running.

float

Maximum angle from vertical (in degrees) the player can run up.

float

Minimum impact speed to apply falling damage.

float

Minimum impact speed to apply non-falling damage.

float

Maximum horizontal speed.

float

Horizontal speed at which resistence will take place.

float

Factor of resistence once horizResistSpeed has been reached.

float

Maximum upwards speed.

float

Upwards speed at which resistence will take place.

float

Factor of resistence once upResistSpeed has been reached.

Movement: Jumping

float

Force used to accelerate the player when a jump is initiated.

float

Energy level drained each time the player jumps.

float

Minimum energy level required to jump.

float

Minimum speed needed to jump.

float

Maximum vertical speed before the player can no longer jump.

float

Angle from vertical (in degrees) where the player can jump.

int

Delay time in number of ticks ticks between jumps.

float

Amount of movement control the player has when in the air.

bool

Controls the direction of the jump impulse.

Movement: Sprinting

float

Force used to accelerate the player when sprinting.

float

Energy value drained each tick that the player is sprinting.

float

Minimum energy level required to sprint.

float

Maximum forward speed when sprinting.

float

Maximum backward speed when sprinting.

float

Maximum sideways speed when sprinting.

float

Amount to scale strafing motion vector while sprinting.

float

Amount to scale yaw motion while sprinting.

float

Amount to scale pitch motion while sprinting.

bool

Can the player jump while sprinting.

Movement: Swimming

float

Force used to accelerate the player when swimming.

float

Maximum forward speed when underwater.

float

Maximum backward speed when underwater.

float

Maximum sideways speed when underwater.

Movement: Crouching

float

Force used to accelerate the player when crouching.

float

Maximum forward speed when crouching.

float

Maximum backward speed when crouching.

float

Maximum sideways speed when crouching.

Movement: Prone

float

Force used to accelerate the player when prone (laying down).

float

Maximum forward speed when prone (laying down).

float

Maximum backward speed when prone (laying down).

float

Maximum sideways speed when prone (laying down).

Movement: Jetting

float

Force used to accelerate the player when a jet jump is initiated.

float

Energy level drained each time the player jet jumps.

float

Minimum energy level required to jet jump.

float

Minimum speed needed to jet jump.

float

Maximum vertical speed before the player can no longer jet jump.

float

Angle from vertical (in degrees) where the player can jet jump.

Falling

float

Downward speed at which we consider the player falling.

int

Number of ticks for the player to recover from falling.

float

Scale factor applied to runForce while in the recover state.

float

Time of land sequence play back when using new recover system.

bool

When going from a fall to a land, should we transition between the two.

Collision

Point3F

Size of the bounding box used by the player for collision.

Point3F

Collision bounding box used when the player is crouching.

Point3F

Collision bounding box used when the player is prone (laying down).

Point3F

Collision bounding box used when the player is swimming.

float

Percentage of the player's bounding box height that represents the head.

float

Percentage of the player's bounding box height that represents the torso.

float

Percentage of the player's bounding box width that represents the left side of the head.

float

Percentage of the player's bounding box width that represents the right side of the head.

float

Percentage of the player's bounding box depth that represents the back side of the head.

float

Percentage of the player's bounding box depth that represents the front side of the head.

Interaction: Footsteps

Particle emitter used to generate footpuffs (particles created as the player walks along the ground).

int

Number of footpuff particles to generate each step.

float

Particle creation radius for footpuff particles.

Emitter used to generate dust particles.

Decal to place on the ground for player footsteps.

float

Distance from the center of the model to the right foot.

Interaction: Sounds

Sound to play when walking on a surface with Material footstepSoundId 0.

Sound to play when walking on a surface with Material footstepSoundId 1.

Sound to play when walking on a surface with Material footstepSoundId 2.

Sound to play when walking on a surface with Material footstepSoundId 3.

Sound to play when walking in water and coverage is less than footSplashHeight.

Sound to play when walking in water and coverage is less than 1, but > footSplashHeight.

Sound to play when walking in water and coverage equals 1.0 (fully underwater).

Sound to play when walking in water and coverage equals 1.0 (fully underwater).

Sound to play when in water and coverage equals 1.0 (fully underwater).

Sound to play when in water and coverage equals 1.0 (fully underwater).

Sound to play after falling on a surface with Material footstepSoundId 0.

Sound to play after falling on a surface with Material footstepSoundId 1.

Sound to play after falling on a surface with Material footstepSoundId 2.

Sound to play after falling on a surface with Material footstepSoundId 3.

Sound to play when entering the water with velocity < mediumSplashSoundVelocity.

Sound to play when entering the water with velocity >= mediumSplashSoundVelocity and < hardSplashSoundVelocity.

Sound to play when entering the water with velocity >= hardSplashSoundVelocity.

Sound to play when exiting the water with velocity >= exitSplashSoundVelocity.

Interaction: Splashes

SplashData datablock used to create splashes when the player moves through water.

float

Minimum velocity when moving through water to generate splashes.

float

Maximum angle (in degrees) from pure vertical movement in water to generate splashes.

float

Multipled by speed to determine the number of splash particles to generate.

float

Minimum speed to generate splash particles.

float

Time in seconds to generate bubble particles after entering the water.

Particle emitters used to generate splash particles.

float

Water coverage level to choose between FootShallowSound and FootWadingSound.

float

Minimum velocity when entering the water for choosing between the impactWaterEasy and impactWaterMedium sounds to play.

float

Minimum velocity when entering the water for choosing between the impactWaterMedium and impactWaterHard sound to play.

float

Minimum velocity when leaving the water for the exitingWater sound to play.

Interaction: Ground Impact

float

Minimum falling impact speed to apply damage and initiate the camera shaking effect.

Point3F

Frequency of the camera shake effect after falling.

Point3F

Amplitude of the camera shake effect after falling.

float

Duration (in seconds) of the camera shake effect after falling.

float

Falloff factor of the camera shake effect after falling.

Physics

string

Specifies the type of physics used by the player.

First Person Arms

caseString

Optional prefix to all mounted image animation sequences in first person.

filename

File name of this player's shape that will be used in conjunction with the corresponding mounted image.

Third Person

caseString

Optional prefix to all mounted image animation sequences in third person.

bool

Allow mounted images to request a sequence be played on the Player.

Callbacks

void
onPoseChange(Player obj, string oldPose, string newPose)

Called when the player changes poses.

void

Called when the player starts swimming.

void

Called when the player stops swimming.

void

Called when the player starts moving while in a Sprint pose.

void

Called when the player stops moving while in a Sprint pose.

void

Called when attempting to dismount the player from a vehicle.

void
onEnterLiquid(Player obj, float coverage, string type)

Called when the player enters a liquid.

void
onLeaveLiquid(Player obj, string type)

Called when the player leaves a liquid.

void

Called on the server when a scripted animation completes.

void

Called when the player enters the mission area.

void

Called when the player leaves the mission area.

Public Attributes

float

Maximum time scale for action animations.

float

Radius around the player to collide with Items in the scene (on server).

Detailed Description

Defines properties for a Player object.

see:

Camera

The settings used by the shape when it is the camera.

bool renderFirstPerson 

Flag controlling whether to render the player shape in first person view.

bool firstPersonShadows 

Forces shadows to be rendered in first person when renderFirstPerson is disabled. Defaults to false.

float minLookAngle 

Lowest angle (in radians) the player can look.

note:

An angle of zero is straight ahead, with positive up and negative down.

float maxLookAngle 

Highest angle (in radians) the player can look.

note:

An angle of zero is straight ahead, with positive up and negative down.

float maxFreelookAngle 

Defines the maximum left and right angles (in radians) the player can look in freelook mode.

Movement

float MaxStepHeight 

Maximum height the player can step up.

The player will automatically step onto changes in ground height less than maxStepHeight. The player will collide with ground height changes greater than this.

float runForce 

Force used to accelerate the player when running.

float runEnergyDrain 

Energy value drained each tick that the player is moving.

The player will not be able to move when his energy falls below minRunEnergy.

note:

Setting this to zero will disable any energy drain.

float minRunEnergy 

Minimum energy level required to run or swim.

float maxForwardSpeed 

Maximum forward speed when running.

float maxBackwardSpeed 

Maximum backward speed when running.

float maxSideSpeed 

Maximum sideways speed when running.

float runSurfaceAngle 

Maximum angle from vertical (in degrees) the player can run up.

float minImpactSpeed 

Minimum impact speed to apply falling damage.

This field also sets the minimum speed for the onImpact callback to be invoked.

float minLateralImpactSpeed 

Minimum impact speed to apply non-falling damage.

This field also sets the minimum speed for the onLateralImpact callback to be invoked.

see:

ShapeBaseData::onLateralImpact()

float horizMaxSpeed 

Maximum horizontal speed.

note:

This limit is only enforced if the player's horizontal speed exceeds horizResistSpeed.

float horizResistSpeed 

Horizontal speed at which resistence will take place.

float horizResistFactor 

Factor of resistence once horizResistSpeed has been reached.

float upMaxSpeed 

Maximum upwards speed.

note:

This limit is only enforced if the player's upward speed exceeds upResistSpeed.

float upResistSpeed 

Upwards speed at which resistence will take place.

float upResistFactor 

Factor of resistence once upResistSpeed has been reached.

Movement: Jumping

float jumpForce 

Force used to accelerate the player when a jump is initiated.

float jumpEnergyDrain 

Energy level drained each time the player jumps.

note:

Setting this to zero will disable any energy drain

float minJumpEnergy 

Minimum energy level required to jump.

float minJumpSpeed 

Minimum speed needed to jump.

If the player's own z velocity is greater than this, then it is used to scale the jump speed, up to maxJumpSpeed.

float maxJumpSpeed 

Maximum vertical speed before the player can no longer jump.

float jumpSurfaceAngle 

Angle from vertical (in degrees) where the player can jump.

int jumpDelay 

Delay time in number of ticks ticks between jumps.

float airControl 

Amount of movement control the player has when in the air.

This is applied as a multiplier to the player's x and y motion.

bool jumpTowardsNormal 

Controls the direction of the jump impulse.

When false, jumps are always in the vertical (+Z) direction. When true jumps are in the direction of the ground normal so long as the player is not directly facing the surface. If the player is directly facing the surface, then they will jump straight up.

Movement: Sprinting

float sprintForce 

Force used to accelerate the player when sprinting.

float sprintEnergyDrain 

Energy value drained each tick that the player is sprinting.

The player will not be able to move when his energy falls below sprintEnergyDrain.

note:

Setting this to zero will disable any energy drain.

float minSprintEnergy 

Minimum energy level required to sprint.

float maxSprintForwardSpeed 

Maximum forward speed when sprinting.

float maxSprintBackwardSpeed 

Maximum backward speed when sprinting.

float maxSprintSideSpeed 

Maximum sideways speed when sprinting.

float sprintStrafeScale 

Amount to scale strafing motion vector while sprinting.

float sprintYawScale 

Amount to scale yaw motion while sprinting.

float sprintPitchScale 

Amount to scale pitch motion while sprinting.

bool sprintCanJump 

Can the player jump while sprinting.

Movement: Swimming

float swimForce 

Force used to accelerate the player when swimming.

float maxUnderwaterForwardSpeed 

Maximum forward speed when underwater.

float maxUnderwaterBackwardSpeed 

Maximum backward speed when underwater.

float maxUnderwaterSideSpeed 

Maximum sideways speed when underwater.

Movement: Crouching

float crouchForce 

Force used to accelerate the player when crouching.

float maxCrouchForwardSpeed 

Maximum forward speed when crouching.

float maxCrouchBackwardSpeed 

Maximum backward speed when crouching.

float maxCrouchSideSpeed 

Maximum sideways speed when crouching.

Movement: Prone

float proneForce 

Force used to accelerate the player when prone (laying down).

float maxProneForwardSpeed 

Maximum forward speed when prone (laying down).

float maxProneBackwardSpeed 

Maximum backward speed when prone (laying down).

float maxProneSideSpeed 

Maximum sideways speed when prone (laying down).

Movement: Jetting

float jetJumpForce 

Force used to accelerate the player when a jet jump is initiated.

float jetJumpEnergyDrain 

Energy level drained each time the player jet jumps.

note:

Setting this to zero will disable any energy drain

float jetMinJumpEnergy 

Minimum energy level required to jet jump.

float jetMinJumpSpeed 

Minimum speed needed to jet jump.

If the player's own z velocity is greater than this, then it is used to scale the jet jump speed, up to jetMaxJumpSpeed.

float jetMaxJumpSpeed 

Maximum vertical speed before the player can no longer jet jump.

float jetJumpSurfaceAngle 

Angle from vertical (in degrees) where the player can jet jump.

Falling

float fallingSpeedThreshold 

Downward speed at which we consider the player falling.

int recoverDelay 

Number of ticks for the player to recover from falling.

float recoverRunForceScale 

Scale factor applied to runForce while in the recover state.

This can be used to temporarily slow the player's movement after a fall, or prevent the player from moving at all if set to zero.

float landSequenceTime 

Time of land sequence play back when using new recover system.

If greater than 0 then the legacy fall recovery system will be bypassed in favour of just playing the player's land sequence. The time to recover from a fall then becomes this parameter's time and the land sequence's playback will be scaled to match.

bool transitionToLand 

When going from a fall to a land, should we transition between the two.

note:

Only takes affect when landSequenceTime is greater than 0.

Collision

Point3F boundingBox 

Size of the bounding box used by the player for collision.

Dimensions are given as "width depth height".

Point3F crouchBoundingBox 

Collision bounding box used when the player is crouching.

Point3F proneBoundingBox 

Collision bounding box used when the player is prone (laying down).

Point3F swimBoundingBox 

Collision bounding box used when the player is swimming.

float boxHeadPercentage 

Percentage of the player's bounding box height that represents the head.

Used when computing the damage location.

float boxTorsoPercentage 

Percentage of the player's bounding box height that represents the torso.

Used when computing the damage location.

float boxHeadLeftPercentage 

Percentage of the player's bounding box width that represents the left side of the head.

Used when computing the damage location.

float boxHeadRightPercentage 

Percentage of the player's bounding box width that represents the right side of the head.

Used when computing the damage location.

float boxHeadBackPercentage 

Percentage of the player's bounding box depth that represents the back side of the head.

Used when computing the damage location.

float boxHeadFrontPercentage 

Percentage of the player's bounding box depth that represents the front side of the head.

Used when computing the damage location.

Interaction: Footsteps

ParticleEmitterData footPuffEmitter 

Particle emitter used to generate footpuffs (particles created as the player walks along the ground).

note:

The generation of foot puffs requires the appropriate triggeres to be defined in the player's animation sequences. Without these, no foot puffs will be generated.

int footPuffNumParts 

Number of footpuff particles to generate each step.

Each foot puff is randomly placed within the defined foot puff radius. This includes having footPuffNumParts set to one.

float footPuffRadius 

Particle creation radius for footpuff particles.

This is applied to each foot puff particle, even if footPuffNumParts is set to one. So set this value to zero if you want a single foot puff placed at exactly the same location under the player each time.

ParticleEmitterData dustEmitter 

Emitter used to generate dust particles.

note:

Currently unused.

DecalData DecalData 

Decal to place on the ground for player footsteps.

float decalOffset 

Distance from the center of the model to the right foot.

While this defines the distance to the right foot, it is also used to place the left foot decal as well. Just on the opposite side of the player.

Interaction: Sounds

SFXTrack FootSoftSound 

Sound to play when walking on a surface with Material footstepSoundId 0.

SFXTrack FootHardSound 

Sound to play when walking on a surface with Material footstepSoundId 1.

SFXTrack FootMetalSound 

Sound to play when walking on a surface with Material footstepSoundId 2.

SFXTrack FootSnowSound 

Sound to play when walking on a surface with Material footstepSoundId 3.

SFXTrack FootShallowSound 

Sound to play when walking in water and coverage is less than footSplashHeight.

see:

footSplashHeight

SFXTrack FootWadingSound 

Sound to play when walking in water and coverage is less than 1, but > footSplashHeight.

see:

footSplashHeight

SFXTrack FootUnderwaterSound 

Sound to play when walking in water and coverage equals 1.0 (fully underwater).

SFXTrack FootBubblesSound 

Sound to play when walking in water and coverage equals 1.0 (fully underwater).

SFXTrack movingBubblesSound 

Sound to play when in water and coverage equals 1.0 (fully underwater).

Note that unlike FootUnderwaterSound, this sound plays even if the player is not moving around in the water.

SFXTrack waterBreathSound 

Sound to play when in water and coverage equals 1.0 (fully underwater).

Note that unlike FootUnderwaterSound, this sound plays even if the player is not moving around in the water.

SFXTrack impactSoftSound 

Sound to play after falling on a surface with Material footstepSoundId 0.

SFXTrack impactHardSound 

Sound to play after falling on a surface with Material footstepSoundId 1.

SFXTrack impactMetalSound 

Sound to play after falling on a surface with Material footstepSoundId 2.

SFXTrack impactSnowSound 

Sound to play after falling on a surface with Material footstepSoundId 3.

SFXTrack impactWaterEasy 

Sound to play when entering the water with velocity < mediumSplashSoundVelocity.

SFXTrack impactWaterMedium 

Sound to play when entering the water with velocity >= mediumSplashSoundVelocity and < hardSplashSoundVelocity.

SFXTrack impactWaterHard 

Sound to play when entering the water with velocity >= hardSplashSoundVelocity.

SFXTrack exitingWater 

Sound to play when exiting the water with velocity >= exitSplashSoundVelocity.

Interaction: Splashes

SplashData Splash 

SplashData datablock used to create splashes when the player moves through water.

float splashVelocity 

Minimum velocity when moving through water to generate splashes.

float splashAngle 

Maximum angle (in degrees) from pure vertical movement in water to generate splashes.

float splashFreqMod 

Multipled by speed to determine the number of splash particles to generate.

float splashVelEpsilon 

Minimum speed to generate splash particles.

float bubbleEmitTime 

Time in seconds to generate bubble particles after entering the water.

ParticleEmitterData splashEmitter [3]

Particle emitters used to generate splash particles.

float footstepSplashHeight 

Water coverage level to choose between FootShallowSound and FootWadingSound.

float mediumSplashSoundVelocity 

Minimum velocity when entering the water for choosing between the impactWaterEasy and impactWaterMedium sounds to play.

float hardSplashSoundVelocity 

Minimum velocity when entering the water for choosing between the impactWaterMedium and impactWaterHard sound to play.

float exitSplashSoundVelocity 

Minimum velocity when leaving the water for the exitingWater sound to play.

Interaction: Ground Impact

float groundImpactMinSpeed 

Minimum falling impact speed to apply damage and initiate the camera shaking effect.

Point3F groundImpactShakeFreq 

Frequency of the camera shake effect after falling.

This is how fast to shake the camera.

Point3F groundImpactShakeAmp 

Amplitude of the camera shake effect after falling.

This is how much to shake the camera.

float groundImpactShakeDuration 

Duration (in seconds) of the camera shake effect after falling.

This is how long to shake the camera.

float groundImpactShakeFalloff 

Falloff factor of the camera shake effect after falling.

This is how to fade the camera shake over the duration.

Physics

string physicsPlayerType 

Specifies the type of physics used by the player.

This depends on the physics module used. An example is 'Capsule'.

note:

Not current used.

First Person Arms

caseString imageAnimPrefixFP 

Optional prefix to all mounted image animation sequences in first person.

This defines a prefix that will be added when looking up mounted image animation sequences while in first person. It allows for the customization of a first person image based on the type of player.

filename shapeNameFP [4]

File name of this player's shape that will be used in conjunction with the corresponding mounted image.

These optional parameters correspond to each mounted image slot to indicate a shape that is rendered in addition to the mounted image shape. Typically these are a player's arms (or arm) that is animated along with the mounted image's state animation sequences.

Third Person

caseString imageAnimPrefix 

Optional prefix to all mounted image animation sequences in third person.

This defines a prefix that will be added when looking up mounted image animation sequences while in third person. It allows for the customization of a third person image based on the type of player.

bool allowImageStateAnimation 

Allow mounted images to request a sequence be played on the Player.

When true a new thread is added to the player to allow for mounted images to request a sequence be played on the player through the image's state machine. It is only optional so that we don't create a TSThread on the player if we don't need to.

Callbacks

onPoseChange(Player obj, string oldPose, string newPose)

Called when the player changes poses.

Parameters:

obj

The Player object

oldPose

The pose the player is switching from.

newPose

The pose the player is switching to.

onStartSwim(Player obj)

Called when the player starts swimming.

Parameters:

obj

The Player object

onStopSwim(Player obj)

Called when the player stops swimming.

Parameters:

obj

The Player object

onStartSprintMotion(Player obj)

Called when the player starts moving while in a Sprint pose.

Parameters:

obj

The Player object

onStopSprintMotion(Player obj)

Called when the player stops moving while in a Sprint pose.

Parameters:

obj

The Player object

doDismount(Player obj)

Called when attempting to dismount the player from a vehicle.

It is up to the doDismount() method to actually perform the dismount. Often there are some conditions that prevent this, such as the vehicle moving too fast. Parameters:

obj

The Player object

onEnterLiquid(Player obj, float coverage, string type)

Called when the player enters a liquid.

Parameters:

obj

The Player object

coverage

Percentage of the player's bounding box covered by the liquid

type

The type of liquid the player has entered

onLeaveLiquid(Player obj, string type)

Called when the player leaves a liquid.

Parameters:

obj

The Player object

type

The type of liquid the player has left

animationDone(Player obj)

Called on the server when a scripted animation completes.

Parameters:

obj

The Player object

see:

Player::setActionThread() for setting a scripted animation and its 'hold' parameter to determine if this callback is used.

onEnterMissionArea(Player obj)

Called when the player enters the mission area.

Parameters:

obj

The Player object

onLeaveMissionArea(Player obj)

Called when the player leaves the mission area.

Parameters:

obj

The Player object

Public Attributes

float maxTimeScale 

Maximum time scale for action animations.

If an action animation has a defined ground frame, it is automatically scaled to match the player's ground velocity. This field limits the maximum time scale used even if the player's velocity exceeds it.

float pickupRadius 

Radius around the player to collide with Items in the scene (on server).

Internally the pickupRadius is added to the larger side of the initial bounding box to determine the actual distance, to a maximum of 2 times the bounding box size. The initial bounding box is that used for the root pose, and therefore doesn't take into account the change in pose.