Unigine.PlayerActor Class
Inherits: | Player |
Interface for player actor handling.
To use this class, include the UniginePlayerActor.h file.
See Also#
- A C# API sample <UnigineSDK>/source/csharp/samples/Api/Nodes/CustomPlayers/CustomPlayerActor
- A set of UnigineScript API samples located in the <UnigineSDK>/data/samples/players/ folder:
- actor_00
- actor_01
- actor_02
PlayerActor Class
Properties
int NumContacts#
The number of contacts, in which the player's capsule participates.
ShapeCapsule Shape#
A shape, which approximates the actor in physical interactions.
Body Body#
A rigid body, if the body is simulated physically (isPhysical(1)); otherwise a dummy body will be returned (isPhysical(0)).
int Ceiling#
A value indicating if the actor touches the ceiling surface with its head.
set
Sets a value indicating if the actor touches the ceiling surface with its head.
set value -
Positive value to indicate that an actor touches the ceiling; otherwise, 0.
int Ground#
A flag indicating if the actor currently stands on the ground surface. this flag is used to determine the actor state, i.e. play the corresponding skinned animation of standing/walking instead of being in the air.
set
Sets a flag indicating that the actor currently stands on the ground surface. This flag is used to set actor state, i.e. play the corresponding skinned animation of standing/walking instead of being in the air.
set value -
Positive value to indicate that the actor is on the ground; otherwise, 0.
vec3 ViewDirection#
The current player's view direction vector.
set
Sets a new Player's view direction vector.
set value -
New view direction vector to be set.
float ThetaAngle#
The theta angle (zenith angle, also known as pitch angle). this angle determines the vertical viewing direction, i.e. upwards or downwards. if a positive value is returned, the player looks upwards; if a negative value is returned, the player looks downwards. the value is clamped between the minimum and the maximum theta angle.
set
Sets the theta angle of the player (zenith angle, also known as pitch angle). This angle determines the vertical viewing direction, i.e. upward and downward. The value will be clamped between the minimum and the maximum theta angle.
set value -
New angle in degrees in range [-90;90]. If a positive value is specified, the player will look upwards; if a negative value is specified, the player will look downwards.
float PhiAngle#
The phi angle (azimuth angle, also known as yaw angle). this angle determines the horizontal viewing direction, i.e. left or right. positive values rotate the player right; negative values rotate the player left.
set
Sets the phi angle (azimuth angle, also known as yaw angle). This angle determines the horizontal viewing direction, i.e. left or right.
set value -
New angle in degrees. Positive values rotate the player to the right; negative values rotate it to the left.
float MaxStepHeight#
The maximum height of a surface to which the player can make a step.
set
Sets the maximum step height. The value defines the maximum height of a surface to which the player can make a step; it can be used for walking up and down the stairs and over curbs.
set value -
Maximum step height.
Used only when the body is not simulated physically (isPhysical(0)).
float Jumping#
The current jumping coefficient.
set
Sets a jumping coefficient. The greater the value, the higher the actor jumps.
set value -
Jumping coefficient. If a negative value is provided, 0 will be used instead.
float Turning#
A velocity of player turning.
set
Sets a velocity of player turning.
set value -
Turning velocity in degrees per second. If a negative value is provided, 0 will be used instead.
float Damping#
Actor's velocity damping with the time.
set
Sets actor's velocity damping with the time.
set value -
New velocity damping. If a negative value is provided, 0 will be used instead.
float Acceleration#
The current acceleration of the actor.
set
Sets an acceleration of the actor.
set value -
New acceleration in units per second squared. If a negative value is provided, 0 will be used instead.
float MaxThetaAngle#
The maximum theta angle (zenith angle, also known as pitch angle) that determines how far downward the player can look. the higher the value, the further down the player can look.
set
Sets the maximum theta angle (zenith angle, also known as pitch angle) that determines how far downward the player can look.
set value -
New maximum angle in degrees in range [0;90]. The higher the value, the further down the player can look.
float MinThetaAngle#
The minimum theta angle (zenith angle, also known as pitch angle) that determines how far upward the player can look. the lower the value, the further up the player can look.
set
Sets the minimum theta angle (zenith angle, also known as pitch angle) that determines how far upward the player can look.
set value -
New minimum angle in degrees in range [-90;0]. The lower the value, the further up the player can look.
float MaxVelocity#
The velocity of the actor, which is used while the actor runs.
set
Sets the velocity of the actor, which is used while the actor runs.
set value -
New velocity in units per second. If a negative value is provided, 0 will be used instead.
float MinVelocity#
The default velocity of the actor.
set
Sets the default velocity of the actor.
set value -
New velocity in units per second. If a negative value is provided, 0 will be used instead.
float MaxFriction#
The friction value set for the actor that is used when the actor doesn't move, i.e. stands still on the ground. see also getMinFriction().
set
Sets a friction value for the actor that is used when the actor doesn't move, i.e. stands still on the ground. See also setMinFriction().
set value -
Friction value. If a negative value is provided, 0 will be used instead.
float MinFriction#
The friction value set for the actor that is used when the actor walks upon the ground. see also getMaxFriction().
set
Sets a friction value for the actor that is used when the actor walks upon the ground. See also setMaxFriction().
set value -
Friction value. If a negative value is provided, 0 will be used instead.
float CollisionHeight#
The height of actor's capsule.
set
Sets a height of actor's capsule.
set value -
New height in units. If a negative value is provided, 0 will be used instead.
float CollisionRadius#
The radius of actor's capsule.
set
Sets a radius of actor's capsule.
set value -
New radius in units. If a negative value is provided, 0 will be used instead.
int CollisionMask#
The collision mask of the actor. two objects collide, if they both have matching masks (i.e. at least one bit matches).
set
Sets a collision mask for the actor. Two objects collide, if they both have matching masks (i.e. at least one bit matches).
set value -
An integer value, each bit of which is a mask.
int Collision#
A value indicating if collisions with a player's capsule should be taken into account. this method is valid only in case setPhysical() is set to 0 and does not handle collisions automatically.
set
Sets a value indicating if collisions with a player's capsule should be taken into account. This method is valid only in case setPhysical() is set to 0 and does not handle collisions automatically.
set value -
Positive number to allow collisions, 0 not to handle collisions with the actor.
int PhysicsIntersectionMask#
A physics intersection mask for a player.
set
Sets a physics intersection mask for a player (masks are considered matching if at least one bit matches).
set value -
An integer value, each bit of which is used to set a bit mask.
int PhysicalMask#
The bit mask for interaction with physicals. two objects interact, if they both have matching masks (i.e. at least one bit matches).
set
Sets the bit mask for interaction with physicals. Two objects interact, if they both have matching masks (i.e. at least one bit matches).
set value -
An integer value, each bit of which is used to set a bit mask.
float PhysicalMass#
The current mass of the actor. if g (Earth's gravity) equals to 9.8 m/s^2, and 1 unit equals to 1 meter, the mass is measured in kilograms.
set
Sets a mass of the actor. If g (Earth's gravity) equals to 9.8 m/s2, and 1 unit equals to 1 meter, the mass is measured in kilograms.
set value -
New mass value. If a negative value is provided, 0 will be used instead.
bool IsPhysical#
A value indicating whether the actor interacts with the environment as a physical object or not.
set
Sets a value indicating whether the actor should interact with the environment as a physical object or not (enables or disables its rigid body). If disabled, collisions can be handled using setCollision() method.
set value -
Physical flag: true to enable rigid body model, false to disable it.
Members
static PlayerActor ( ) #
Constructor. Creates a new actor with default properties.float GetContactDepth ( int contact ) #
Returns penetration depth by the given contact.Arguments
- int contact - Contact number.
Return value
Penetration depth.vec3 GetContactNormal ( int contact ) #
Returns a normal of the contact point, in world coordinates.Arguments
- int contact - Contact number.
Return value
Normal of the contact point.Object GetContactObject ( int contact ) #
Returns an object participating in the contact with the player (used for collisions with physical object).Arguments
- int contact - Contact number.
Return value
Object in contact.vec3 GetContactPoint ( int contact ) #
Returns world coordinates of the contact point.Arguments
- int contact - Contact number.
Return value
Contact point.Shape GetContactShape ( int num ) #
Returns a shape that collided with the player's capsule.Arguments
- int num - Contact number.
Return value
Shape in contact.int GetContactSurface ( int contact ) #
Returns the surface of the current object, which is in contact (used for collisions with non-physical object).Arguments
- int contact - Contact number.
Return value
Surface number.int GetState ( int arg1 ) #
Returns a value indicating if the actor is in a given state.Arguments
- int arg1 - One of the PLAYER_ACTOR_STATE_* pre-defined variables.
Return value
1 if the actor is in the given state; otherwise, 0.float GetStateTime ( int arg1 ) #
Returns time spent by the actor in a given state.Arguments
- int arg1 - One of the PLAYER_ACTOR_STATE_* pre-defined variables.
Return value
Time in seconds spent by the actor in a given state.static int type ( ) #
Returns the type of the player.Return value
PlayerActor type identifier.void SetWorldTransform ( mat4 transform ) #
Sets the transformation matrix for the node in the world coordinates.Mind the axes in this method: X - right, Y - up, Z - back. It is important, that axes for PlayerActor in the getWorldTransform() method are different: X - right, Y - front, Z - up.
// to save:
Mat4 transform = player_actor.getWorldTransform();
Vec3 front = transform.getColumn3(1);
Vec3 up = transform.getColumn3(2);
transform.setColumn3(1, up);
transform.setColumn3(2, -front);
Mat4 spawn_point = ball.getIWorldTransform() * transform;
// to load:
player_actor.setWorldTransform(ball.getWorldTransform() * spawn_point);
Arguments
- mat4 transform - Transformation matrix.
mat4 GetWorldTransform ( ) #
Returns the transformation matrix of the node in the world coordinates.Mind the axes in this method: X - right, Y - front, Z - up. It is important, that axes for PlayerActor in the setWorldTransform() method are different: X - right, Y - up, Z - back.
// to save:
Mat4 transform = player_actor.getWorldTransform();
Vec3 front = transform.getColumn3(1);
Vec3 up = transform.getColumn3(2);
transform.setColumn3(1, up);
transform.setColumn3(2, -front);
Mat4 spawn_point = ball.getIWorldTransform() * transform;
// to load:
player_actor.setWorldTransform(ball.getWorldTransform() * spawn_point);
Return value
Transformation matrix.Last update:
2020-07-31
Help improve this article
Was this article helpful?
(or select a word/phrase and press Ctrl+Enter)