Unigine::PlayerActor Class
Interface for player actor handling.
To use this class, include the UniginePlayerActor.h file.
Unigine::PlayerActor Class
Members
static int type ()
PlayerActor type.Return value
PlayerActor type identifier.static Ptr< PlayerActor > create (const NodePtr & node)
PlayerActor constructor.Arguments
- const NodePtr & node - Node smart pointer.
static Ptr< PlayerActor > create (const PlayerPtr & player)
PlayerActor constructor.Arguments
- const PlayerPtr & player - Player smart pointer.
static Ptr< PlayerActor > create ()
PlayerActor constructor.virtual void setPhysical (int physical) const =0
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 it is disabled, collisions can be handled using setCollision() method.Arguments
- int physical - Physical flag: 1 to enable rigid body model, 0 to disable it.
virtual int isPhysical () const =0
Returns a value indicating whether the actor interacts with the environment as a physical object or not.Return value
Physical flag: 1 if rigid body model is enabled; otherwise, 0.virtual void setPhysicalMass (float mass) const =0
Sets a 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.Arguments
- float mass - New mass value. If a negative value is provided, 0 will be used instead.
virtual float getPhysicalMass () const =0
Returns 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.Return value
Mass value.virtual void setPhysicalMask (int mask) const =0
Sets the bit mask for interaction with physicals. Two objects interact, if they both have matching masks (i.e. at least one bit matches).Arguments
- int mask - An integer value, each bit of which is used to set a bit mask.
virtual int getPhysicalMask () const =0
Returns the bit mask for interaction with physicals. Two objects interact, if they both have matching masks (i.e. at least one bit matches).Return value
An integer value, each bit of which is used to set a bit mask.virtual void setIntersectionMask (int mask) const =0
Sets an intersection mask for a player.Arguments
- int mask - An integer value, each bit of which is used to set a bit mask.
virtual int getIntersectionMask () const =0
Returns an intersection mask for a player.Return value
An integer value, each bit of which is used to set a bit mask.virtual void setCollision (int collision) const =0
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.Arguments
- int collision - 1 to enable collisions, 0 not to handle collisions with the actor.
virtual int getCollision () const =0
Returns 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.Return value
1 if collisions are taken into account; otherwise, 0.virtual void setCollisionMask (int mask) const =0
Sets a collision mask for the actor. Two objects collide, if they both have matching masks (i.e. at least one bit matches).Arguments
- int mask - An integer value, each bit of which is used to set a bit mask.
virtual int getCollisionMask () const =0
Returns the collision mask of the actor. Two objects collide, if they both have matching masks (i.e. at least one bit matches).Return value
An integer value, each bit of which is used to set a bit mask.virtual void setCollisionRadius (float radius) const =0
Sets a radius of actor's capsule.Arguments
- float radius - New radius in units. If a negative value is provided, 0 will be used instead.
virtual float getCollisionRadius () const =0
Returns the radius of actor's capsule.Return value
Radius in units.virtual void setCollisionHeight (float height) const =0
Sets a height of actor's capsule.Arguments
- float height - New height in units. If a negative value is provided, 0 will be used instead.
virtual float getCollisionHeight () const =0
Returns the height of actor's capsule.Return value
Height in units.virtual void setMinFriction (float friction) const =0
Sets a friction value for the actor that is used when the actor walks upon the ground. See also setMaxFriction().Arguments
- float friction - Friction value. If a negative value is provided, 0 will be used instead.
virtual float getMinFriction () const =0
Returns the friction value set for the actor that is used when the actor walks upon the ground. See also getMaxFriction().Return value
Friction value.virtual void setMaxFriction (float friction) const =0
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().Arguments
- float friction - Friction value. If a negative value is provided, 0 will be used instead.
virtual float getMaxFriction () const =0
Returns 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().Return value
Friction value.virtual void setMinVelocity (float velocity) const =0
Sets the default velocity of the actor.Arguments
- float velocity - New velocity in units per second. If a negative value is provided, 0 will be used instead.
virtual float getMinVelocity () const =0
Returns the default velocity of the actor.Return value
Velocity in units per second.virtual void setMaxVelocity (float velocity) const =0
Sets the velocity of the actor, which is used while the actor runs.Arguments
- float velocity - New velocity in units per second. If a negative value is provided, 0 will be used instead.
virtual float getMaxVelocity () const =0
Returns the velocity of the actor, which is used while the actor runs.Return value
Velocity in units per second.virtual void setMinThetaAngle (float angle) const =0
Sets the minimum theta angle (zenith angle, also known as pitch angle) that determines how far upward the player can look.Arguments
- float angle - New minimum angle in degrees in range [-90;0]. The lower the value, the further up the player can look.
virtual float getMinThetaAngle () const =0
Returns 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.Return value
Angle in degrees.virtual void setMaxThetaAngle (float angle) const =0
Sets the maximum theta angle (zenith angle, also known as pitch angle) that determines how far downward the player can look.Arguments
- float angle - New maximum angle in degrees in range [0;90]. The higher the value, the further down the player can look.
virtual float getMaxThetaAngle () const =0
Returns 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.Return value
Angle in degrees.virtual void setAcceleration (float acceleration) const =0
Sets an acceleration of the actor.Arguments
- float acceleration - New acceleration in units per second squared. If a negative value is provided, 0 will be used instead.
virtual float getAcceleration () const =0
Returns the current acceleration of the actor.Return value
Acceleration in units per second squared.virtual void setDamping (float damping) const =0
Sets actor's velocity damping with the time.Arguments
- float damping - New velocity damping. If a negative value is provided, 0 will be used instead.
virtual float getDamping () const =0
Returns actor's velocity damping with the time.Return value
Velocity damping.virtual void setTurning (float turning) const =0
Sets a velocity of player turning.Arguments
- float turning - Turning velocity in degrees per second. If a negative value is provided, 0 will be used instead.
virtual float getTurning () const =0
Returns a velocity of player turning.Return value
Turning velocity in degrees per second.virtual void setJumping (float jumping) const =0
Sets a jumping coefficient. The greater the value, the higher the actor jumps.Arguments
- float jumping - Jumping coefficient. If a negative value is provided, 0 will be used instead.
virtual float getJumping () const =0
Returns the current jumping coefficient.Return value
Jumping coefficient.virtual void setPhiAngle (float angle) const =0
Sets the phi angle (azimuth angle, also known as yaw angle). This angle determines the horizontal viewing direction, i.e. left or right.Arguments
- float angle - New angle in degrees. Positive values rotate the player right; negative values rotate the player left.
virtual float getPhiAngle () const =0
Returns 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.Return value
Angle in degrees.virtual void setThetaAngle (float angle) const =0
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.Arguments
- float angle - 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.
virtual float getThetaAngle () const =0
Returns 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.Return value
Angle in degrees.virtual int getState (int state) const =0
Returns a value indicating if the actor is in a given state.Arguments
- int state - One of the available states with the STATE_* prefix.
Return value
1 if the actor is in the given state; otherwise, 0.virtual float getStateTime (int state) const =0
Returns time spent by the actor in a given state.Arguments
- int state - One of the available states with the STATE_* prefix.
Return value
Time in seconds spent by the actor in a given state.virtual void setGround (int ground) const =0
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.Arguments
- int ground - 1 to indicate that the actor is on the ground; otherwise, 0.
virtual int getGround () const =0
Returns 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.Return value
1 if the actor is on the ground; otherwise, 0.virtual void setCeiling (int ceiling) const =0
Sets a value indicating if the actor touches the ceiling surface with its head.Arguments
- int ceiling - 1 to indicate that an actor touches the ceiling; otherwise, 0.
virtual int getCeiling () const =0
Returns a value indicating if the actor touches the ceiling surface with its head.Return value
1 if the actor touches the ceiling; otherwise, 0.Unigine::PlayerActor::anonymous_89 Enumeration
STATE_FORWARD
= 0
STATE_BACKWARD
STATE_MOVE_LEFT
STATE_MOVE_RIGHT
STATE_TURN_UP
STATE_TURN_DOWN
STATE_TURN_LEFT
STATE_TURN_RIGHT
STATE_CROUCH
STATE_JUMP
STATE_RUN
STATE_USE
STATE_FIRE
NUM_STATES
Unigine::PlayerActor::anonymous_90 Enumeration
STATE_DISABLED
= 0
STATE_ENABLED
STATE_BEGIN
STATE_END
Last update: 2017-07-03
Help improve this article
Was this article helpful?
(or select a word/phrase and press Ctrl+Enter)