Torque 3D - Script Manual: PlayerData Class Reference

TorqueScript

Main   Class List   Namespace List   Online

PlayerData Class Reference
[Game Objects]

Defines properties for a Player object. More...

Inheritance diagram for PlayerData:

List of all members.

Public Member Functions

Callbacks

void animationDone (Player obj)
 Called on the server when a scripted animation completes.
void doDismount (Player obj)
 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 onEnterMissionArea (Player obj)
 Called when the player enters the mission area.
void onLeaveLiquid (Player obj, string type)
 Called when the player leaves a liquid.
void onLeaveMissionArea (Player obj)
 Called when the player leaves the mission area.
void onPoseChange (Player obj, string oldPose, string newPose)
 Called when the player changes poses.
void onStartSprintMotion (Player obj)
 Called when the player starts moving while in a Sprint pose.
void onStartSwim (Player obj)
 Called when the player starts swimming.
void onStopSprintMotion (Player obj)
 Called when the player stops moving while in a Sprint pose.
void onStopSwim (Player obj)
 Called when the player stops swimming.

Public Attributes

float maxTimeScale
 Maximum time scale for action animations.
float pickupRadius
 Radius around the player to collide with Items in the scene (on server).
Movement: Jumping

float airControl
 Amount of movement control the player has when in the air.
int jumpDelay
 Delay time in number of ticks ticks between jumps.
float jumpEnergyDrain
 Energy level drained each time the player jumps.
float jumpForce
 Force used to accelerate the player when a jump is initiated.
float jumpSurfaceAngle
 Angle from vertical (in degrees) where the player can jump.
bool jumpTowardsNormal
 Controls the direction of the jump impulse.
float maxJumpSpeed
 Maximum vertical speed before the player can no longer jump.
float minJumpEnergy
 Minimum energy level required to jump.
float minJumpSpeed
 Minimum speed needed to jump.
Third Person

bool allowImageStateAnimation
 Allow mounted images to request a sequence be played on the Player.
caseString imageAnimPrefix
 Optional prefix to all mounted image animation sequences in third person.
Collision

Point3F boundingBox
 Size of the bounding box used by the player for collision.
float boxHeadBackPercentage
 Percentage of the player's bounding box depth that represents the back side of the head.
float boxHeadFrontPercentage
 Percentage of the player's bounding box depth that represents the front side of the head.
float boxHeadLeftPercentage
 Percentage of the player's bounding box width that represents the left side of the head.
float boxHeadPercentage
 Percentage of the player's bounding box height that represents the head.
float boxHeadRightPercentage
 Percentage of the player's bounding box width that represents the right side of the head.
float boxTorsoPercentage
 Percentage of the player's bounding box height that represents the torso.
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.
Interaction: Splashes

float bubbleEmitTime
 Time in seconds to generate bubble particles after entering the water.
float exitSplashSoundVelocity
 Minimum velocity when leaving the water for the exitingWater sound to play.
float footstepSplashHeight
 Water coverage level to choose between FootShallowSound and FootWadingSound.
float hardSplashSoundVelocity
 Minimum velocity when entering the water for choosing between the impactWaterMedium and impactWaterHard sound to play.
float mediumSplashSoundVelocity
 Minimum velocity when entering the water for choosing between the impactWaterEasy and impactWaterMedium sounds to play.
SplashData Splash
 SplashData datablock used to create splashes when the player moves through water.
float splashAngle
 Maximum angle (in degrees) from pure vertical movement in water to generate splashes.
ParticleEmitterData splashEmitter [3]
 Particle emitters used to generate splash particles.
float splashFreqMod
 Multipled by speed to determine the number of splash particles to generate.
float splashVelEpsilon
 Minimum speed to generate splash particles.
float splashVelocity
 Minimum velocity when moving through water to generate splashes.
Movement: Crouching

float crouchForce
 Force used to accelerate the player when crouching.
float maxCrouchBackwardSpeed
 Maximum backward speed when crouching.
float maxCrouchForwardSpeed
 Maximum forward speed when crouching.
float maxCrouchSideSpeed
 Maximum sideways speed when crouching.
Interaction: Footsteps

DecalData DecalData
 Decal to place on the ground for player footsteps.
float decalOffset
 Distance from the center of the model to the right foot.
ParticleEmitterData dustEmitter
 Emitter used to generate dust particles.
ParticleEmitterData footPuffEmitter
 Particle emitter used to generate footpuffs (particles created as the player walks along the ground).
int footPuffNumParts
 Number of footpuff particles to generate each step.
float footPuffRadius
 Particle creation radius for footpuff particles.
Interaction: Sounds

SFXTrack exitingWater
 Sound to play when exiting the water with velocity >= exitSplashSoundVelocity.
SFXTrack FootBubblesSound
 Sound to play when walking in water and coverage equals 1.0 (fully underwater).
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 FootShallowSound
 Sound to play when walking in water and coverage is less than footSplashHeight.
SFXTrack FootSnowSound
 Sound to play when walking on a surface with Material footstepSoundId 3.
SFXTrack FootSoftSound
 Sound to play when walking on a surface with Material footstepSoundId 0.
SFXTrack FootUnderwaterSound
 Sound to play when walking in water and coverage equals 1.0 (fully underwater).
SFXTrack FootWadingSound
 Sound to play when walking in water and coverage is less than 1, but > footSplashHeight.
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 impactSoftSound
 Sound to play after falling on a surface with Material footstepSoundId 0.
SFXTrack impactWaterEasy
 Sound to play when entering the water with velocity < mediumSplashSoundVelocity.
SFXTrack impactWaterHard
 Sound to play when entering the water with velocity >= hardSplashSoundVelocity.
SFXTrack impactWaterMedium
 Sound to play when entering the water with velocity >= mediumSplashSoundVelocity and < hardSplashSoundVelocity.
SFXTrack movingBubblesSound
 Sound to play when in water and coverage equals 1.0 (fully underwater).
SFXTrack waterBreathSound
 Sound to play when in water and coverage equals 1.0 (fully underwater).
Falling

float fallingSpeedThreshold
 Downward speed at which we consider the player falling.
float landSequenceTime
 Time of land sequence play back when using new recover system.
int recoverDelay
 Number of ticks for the player to recover from falling.
float recoverRunForceScale
 Scale factor applied to runForce while in the recover state.
bool transitionToLand
 When going from a fall to a land, should we transition between the two.
Camera

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

bool firstPersonShadows
 Forces shadows to be rendered in first person when renderFirstPerson is disabled. Defaults to false.
float maxFreelookAngle
 Defines the maximum left and right angles (in radians) the player can look in freelook mode.
float maxLookAngle
 Highest angle (in radians) the player can look.
float minLookAngle
 Lowest angle (in radians) the player can look.
bool renderFirstPerson
 Flag controlling whether to render the player shape in first person view.
Interaction: Ground Impact

float groundImpactMinSpeed
 Minimum falling impact speed to apply damage and initiate the camera shaking effect.
Point3F groundImpactShakeAmp
 Amplitude of the camera shake effect after falling.
float groundImpactShakeDuration
 Duration (in seconds) of the camera shake effect after falling.
float groundImpactShakeFalloff
 Falloff factor of the camera shake effect after falling.
Point3F groundImpactShakeFreq
 Frequency of the camera shake effect after falling.
Movement

float horizMaxSpeed
 Maximum horizontal speed.
float horizResistFactor
 Factor of resistence once horizResistSpeed has been reached.
float horizResistSpeed
 Horizontal speed at which resistence will take place.
float maxBackwardSpeed
 Maximum backward speed when running.
float maxForwardSpeed
 Maximum forward speed when running.
float maxSideSpeed
 Maximum sideways speed when running.
float maxStepHeight
 Maximum height the player can step up.
float minImpactSpeed
 Minimum impact speed to apply falling damage.
float minLateralImpactSpeed
 Minimum impact speed to apply non-falling damage.
float minRunEnergy
 Minimum energy level required to run or swim.
float runEnergyDrain
 Energy value drained each tick that the player is moving.
float runForce
 Force used to accelerate the player when running.
float runSurfaceAngle
 Maximum angle from vertical (in degrees) the player can run up.
float upMaxSpeed
 Maximum upwards speed.
float upResistFactor
 Factor of resistence once upResistSpeed has been reached.
float upResistSpeed
 Upwards speed at which resistence will take place.
First Person Arms

caseString imageAnimPrefixFP
 Optional prefix to all mounted image animation sequences in first person.
filename shapeNameFP [4]
 File name of this player's shape that will be used in conjunction with the corresponding mounted image.
Movement: Jetting

float jetJumpEnergyDrain
 Energy level drained each time the player jet jumps.
float jetJumpForce
 Force used to accelerate the player when a jet jump is initiated.
float jetJumpSurfaceAngle
 Angle from vertical (in degrees) where the player can jet jump.
float jetMaxJumpSpeed
 Maximum vertical speed before the player can no longer jet jump.
float jetMinJumpEnergy
 Minimum energy level required to jet jump.
float jetMinJumpSpeed
 Minimum speed needed to jet jump.
Movement: Prone

float maxProneBackwardSpeed
 Maximum backward speed when prone (laying down).
float maxProneForwardSpeed
 Maximum forward speed when prone (laying down).
float maxProneSideSpeed
 Maximum sideways speed when prone (laying down).
float proneForce
 Force used to accelerate the player when prone (laying down).
Movement: Sprinting

float maxSprintBackwardSpeed
 Maximum backward speed when sprinting.
float maxSprintForwardSpeed
 Maximum forward speed when sprinting.
float maxSprintSideSpeed
 Maximum sideways speed when sprinting.
float minSprintEnergy
 Minimum energy level required to sprint.
bool sprintCanJump
 Can the player jump while sprinting.
float sprintEnergyDrain
 Energy value drained each tick that the player is sprinting.
float sprintForce
 Force used to accelerate the player when sprinting.
float sprintPitchScale
 Amount to scale pitch motion while sprinting.
float sprintStrafeScale
 Amount to scale strafing motion vector while sprinting.
float sprintYawScale
 Amount to scale yaw motion while sprinting.
Movement: Swimming

float maxUnderwaterBackwardSpeed
 Maximum backward speed when underwater.
float maxUnderwaterForwardSpeed
 Maximum forward speed when underwater.
float maxUnderwaterSideSpeed
 Maximum sideways speed when underwater.
float swimForce
 Force used to accelerate the player when swimming.
Physics

string physicsPlayerType
 Specifies the type of physics used by the player.

Detailed Description

Defines properties for a Player object.

See also:
Player

Member Function Documentation

void PlayerData::animationDone ( Player  obj  ) 

Called on the server when a scripted animation completes.

Parameters:
obj The Player object
See also:
Player::setActionThread() for setting a scripted animation and its 'hold' parameter to determine if this callback is used.
void PlayerData::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
void PlayerData::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
void PlayerData::onEnterMissionArea ( Player  obj  ) 

Called when the player enters the mission area.

Parameters:
obj The Player object
See also:
MissionArea
void PlayerData::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
void PlayerData::onLeaveMissionArea ( Player  obj  ) 

Called when the player leaves the mission area.

Parameters:
obj The Player object
See also:
MissionArea
void PlayerData::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.
void PlayerData::onStartSprintMotion ( Player  obj  ) 

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

Parameters:
obj The Player object
void PlayerData::onStartSwim ( Player  obj  ) 

Called when the player starts swimming.

Parameters:
obj The Player object
void PlayerData::onStopSprintMotion ( Player  obj  ) 

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

Parameters:
obj The Player object
void PlayerData::onStopSwim ( Player  obj  ) 

Called when the player stops swimming.

Parameters:
obj The Player object

Member Data Documentation

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.

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.

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

Dimensions are given as "width depth height".

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

Used when computing the damage location.

See also:
Player::getDamageLocation

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

Used when computing the damage location.

See also:
Player::getDamageLocation

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

Used when computing the damage location.

See also:
Player::getDamageLocation

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

Used when computing the damage location.

See also:
Player::getDamageLocation

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

Used when computing the damage location.

See also:
Player::getDamageLocation

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

Used when computing the damage location.

See also:
Player::getDamageLocation

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

Collision bounding box used when the player is crouching.

See also:
boundingBox

Force used to accelerate the player when crouching.

Decal to place on the ground for player footsteps.

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.

Emitter used to generate dust particles.

Note:
Currently unused.

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

See also:
exitSplashSoundVelocity

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

See also:
exitingWater

Downward speed at which we consider the player falling.

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

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

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

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

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.

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.

See also:
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.

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

See also:
footSplashHeight

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

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

Water coverage level to choose between FootShallowSound and FootWadingSound.

See also:
FootShallowSound
FootWadingSound

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

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

See also:
footSplashHeight

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

Amplitude of the camera shake effect after falling.

This is how much to shake the camera.

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

This is how long to shake the camera.

Falloff factor of the camera shake effect after falling.

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

Frequency of the camera shake effect after falling.

This is how fast to shake the camera.

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

See also:
impactWaterMedium
impactWaterHard

Maximum horizontal speed.

Note:
This limit is only enforced if the player's horizontal speed exceeds horizResistSpeed.
See also:
horizResistSpeed
horizResistFactor

Factor of resistence once horizResistSpeed has been reached.

See also:
horizMaxSpeed
horizResistSpeed

Horizontal speed at which resistence will take place.

See also:
horizMaxSpeed
horizResistFactor

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.

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.

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 after falling on a surface with Material footstepSoundId 0.

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

See also:
mediumSplashSoundVelocity

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

See also:
hardSplashSoundVelocity

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

See also:
mediumSplashSoundVelocity
hardSplashSoundVelocity

Energy level drained each time the player jet jumps.

Note:
Setting this to zero will disable any energy drain
See also:
jetMinJumpEnergy

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

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

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

Minimum energy level required to jet jump.

See also:
jetJumpEnergyDrain

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.

See also:
jetMaxJumpSpeed

Delay time in number of ticks ticks between jumps.

Energy level drained each time the player jumps.

Note:
Setting this to zero will disable any energy drain
See also:
minJumpEnergy

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

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

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.

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.

See also:
transitionToLand

Maximum backward speed when running.

Maximum backward speed when crouching.

Maximum forward speed when crouching.

Maximum sideways speed when crouching.

Maximum forward speed when running.

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

Maximum vertical speed before the player can no longer jump.

Highest angle (in radians) the player can look.

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

Maximum backward speed when prone (laying down).

Maximum forward speed when prone (laying down).

Maximum sideways speed when prone (laying down).

Maximum sideways speed when running.

Maximum backward speed when sprinting.

Maximum forward speed when sprinting.

Maximum sideways speed when sprinting.

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.

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.

Maximum backward speed when underwater.

Maximum forward speed when underwater.

Maximum sideways speed when underwater.

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

See also:
impactWaterEasy
impactWaterMedium

Minimum impact speed to apply falling damage.

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

See also:
ShapeBaseData::onImpact()

Minimum energy level required to jump.

See also:
jumpEnergyDrain

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.

See also:
maxJumpSpeed

Minimum impact speed to apply non-falling damage.

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

See also:
ShapeBaseData::onLateralImpact()

Lowest angle (in radians) the player can look.

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

Minimum energy level required to run or swim.

See also:
runEnergyDrain

Minimum energy level required to sprint.

See also:
sprintEnergyDrain

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.

Specifies the type of physics used by the player.

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

Note:
Not current used.

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.

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

See also:
boundingBox

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

Number of ticks for the player to recover from falling.

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.

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

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.
See also:
minRunEnergy

Force used to accelerate the player when running.

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

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.

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

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

Particle emitters used to generate splash particles.

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

Minimum speed to generate splash particles.

Minimum velocity when moving through water to generate splashes.

Can the player jump while sprinting.

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.
See also:
minSprintEnergy

Force used to accelerate the player when sprinting.

Amount to scale pitch motion while sprinting.

Amount to scale strafing motion vector while sprinting.

Amount to scale yaw motion while sprinting.

Collision bounding box used when the player is swimming.

See also:
boundingBox

Force used to accelerate the player when swimming.

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

Note:
Only takes affect when landSequenceTime is greater than 0.
See also:
landSequenceTime

Maximum upwards speed.

Note:
This limit is only enforced if the player's upward speed exceeds upResistSpeed.
See also:
upResistSpeed
upResistFactor

Factor of resistence once upResistSpeed has been reached.

See also:
upMaxSpeed
upResistSpeed

Upwards speed at which resistence will take place.

See also:
upMaxSpeed
upResistFactor

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.



Copyright © GarageGames, LLC. All Rights Reserved.