This page has been translated automatically.
Programming
Fundamentials
Setting Up Development Environment
UnigineScript
High-Level Systems
C++
C#
UUSL (Unified UNIGINE Shader Language)
File Formats
Rebuilding the Engine and Tools
GUI
Double Precision Coordinates
API
Bounds-Related Classes
Containers
Controls-Related Classes
Core Library
Engine-Related Classes
GUI-Related Classes
Node-Related Classes
Pathfinding-Related Classes
Physics-Related Classes
Plugins-Related Classes
Rendering-Related Classes
Utility Classes
Warning! This version of documentation is OUTDATED, as it describes an older SDK version! Please switch to the documentation for the latest SDK version.
Warning! This version of documentation describes an old SDK version which is no longer supported! Please upgrade to the latest SDK version.

PlayerSpectator Class

Interface for player spectator handling.

To use this class, include the UniginePlayerSpectator.h file.

PlayerSpectator Class

Members


PlayerSpectator ()

Constructor. Creates a new spectator with default properties.

Math::Vec3 getContactPoint (int contact)

Returns world coordinates of the contact point.

Arguments

  • int contact - Contact number.

Return value

Contact point.

void setDamping (float damping)

Sets a spectator's damping.

Arguments

  • float damping - New damping value.

float getMinVelocity ()

Returns the default velocity of the spectator.

Return value

Velocity in units per second.

void setMaxThetaAngle (float angle)

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 angle in degrees in range [0;90]. The higher the value, the further down the player can look.

void setPhiAngle (float angle)

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.

float getContactDepth (int contact)

Returns penetration depth by the given contact.

Arguments

  • int contact - Contact number.

Return value

Penetration depth.

void setCollisionMask (int mask)

Sets a collision mask for the spectators's collision sphere. Two objects collide, if they both have matching masks.

Arguments

  • int mask - An integer value, each bit of which is used to set a bit mask.

void setThetaAngle (float angle)

Sets the theta angle of the player (zenith angle, also known as pitch angle). This angle determines the vertical viewing direction, i.e. upwards or downwards. 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.

void setMinThetaAngle (float angle)

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 angle in degrees in range [-90;0]. The lower the value, the further up the player can look.

void setMaxVelocity (float velocity)

Sets the velocity of the actor, which is used while the actor runs (the Controls::STATE_RUN control state is "pressed").

Arguments

  • float velocity - New velocity in units per second. If a negative value is provided, 0 will be used instead.

float getCollisionRadius ()

Returns radius of the spectators's collision sphere.

Return value

Radius of the collision sphere in units.

int getCollisionMask ()

Returns a collision mask of the spectators's collision sphere. Two objects collide, if they both have matching masks.

Return value

An integer value, each bit of which is used to set a bit mask.

Ptr<Shape> getContactShape (int num)

Returns a shape that collided with the player.

Arguments

  • int num - Contact number.

Return value

Shape in contact.

float getTurning ()

Returns a velocity of player turning.

Return value

Turning velocity in degrees per second.

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.

Math::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.

float getThetaAngle ()

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

Theta angle value.

void setAcceleration (float acceleration)

Sets an acceleration of the spectator.

Arguments

  • float acceleration - New acceleration in units per second squared. If a negative value is provided, 0 will be used instead.

void setMinVelocity (float velocity)

Sets the default velocity of the spectator.

Arguments

  • float velocity - New velocity in units per second. If a negative value is provided, 0 will be used instead.

float getMaxVelocity ()

Returns the velocity of the actor, which is used while the actor runs (the Controls::STATE_RUN control state is "pressed").

Return value

Velocity in units per second.

int getCollision ()

Returns a value indicating if collisions with spectator's sphere should be taken into account.

Return value

1 if collisions are taken into account; otherwise, 0.

float getMinThetaAngle ()

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

Current minimum theta angle in degrees.

float getDamping ()

Returns the spectator's damping.

Return value

Damping value.

float getAcceleration ()

Returns the current acceleration of the spectator.

Return value

Acceleration in units per second squared.

void setCollisionRadius (float radius)

Updates radius of the spectators's collision sphere.

Arguments

  • float radius - New radius of the collision sphere.

void setTurning (float turning)

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.

Ptr<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.

void setCollision (int collision)

Updates a value indicating if collisions with spectator's sphere should be taken into account.

Arguments

  • int collision - 1 to enable collisions, 0 to let the spectator fly through objects.

int getNumContacts ()

Returns the number of contacts, in which the spectator's sphere participates.

Return value

Number of contacts.

float getPhiAngle ()

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 it to the left.

Return value

Phi angle value.

float getMaxThetaAngle ()

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

Current maximum theta angle in degrees.

getViewDirection ()

setViewDirection (const Math::vec3 & direction)

Arguments

  • const Math::vec3 & direction
Last update: 2017-07-03
Build: ()