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
Core Library
Containers
Engine Classes
Node-Related Classes
Rendering-Related Classes
Physics-Related Classes
Bounds-Related Classes
GUI-Related Classes
Controls-Related Classes
Pathfinding-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.

Player Class

Interface for player handling. See also the UnigineScript analog.

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

Player Class

Members


Ptr<Player> getPlayer ()

Returns a player pointer.

Return value

The player pointer.

int getSourceMask ()

Returns the source mask that determines sound sources, which can be heard. For a sound source to be heard, its mask should match with this one in at least one bit. Plus, the volume of sound channel in which the sound plays (its number also depends on this mask) should not be equal to 0.

Return value

Source mask (integer, each bit of which specifies a sound channel).

void setReverbMask (int mask)

Sets a reverb mask that determines reverberation zones, which can be heard. For sound to reverberate, at least one bit of this mask should match with a reverb mask of the sound source and a reverb mask of the reverberation zone. Masks of a sound source and reverberation zone can match with the player's one in different bits, not necessarily one.

Arguments

  • int mask - Reverb mask (integer, each bit of which is a mask for reverberating sound sources and reverberation zones).

void flushTransform ()

Forces to immediately set transformations to the player. This function should be called manually after user input has been updated via updateControls().

Math::vec3 getVelocity ()

Returns the current velocity of the player.

Return value

Velocity in units per second.

void setCamera (const Ptr<Camera> & camera)

Arguments

  • const Ptr<Camera> & camera

void setSourceMask (int mask)

Sets a source mask that determines sound sources, which can be heard. For a sound source to be heard, its mask should match with this one in at least one bit. Plus, the volume of sound channel in which the sound plays (its number also depends on this mask) should not be equal to 0.

Arguments

  • int mask - Source mask (integer, each bit of which specifies a sound channel).

void setVelocity (const Math::vec3 & velocity)

Sets a new velocity for the player. In case of PlayerActor, this function is valid only when the player is not simulated physically (setPhysical() is set to 0). If it is, moving PlayerActor is done via accessing its body.

Arguments

  • const Math::vec3 & velocity - New velocity in units per second.

void setViewportMask (int mask)

Sets a viewport mask. Object surfaces, materials, decals, lights and GUI objects will be rendered into the viewport only if their viewport mask matches the player's one (one matching bit is enough).

Arguments

  • int mask - Viewport mask (integer, each bit of which is a mask).

void updateControls (float ifps)

Gets the current player's parameters (impulse, direction, velocity etc) according to user input. After the input has been updated, flushTransform() should be called manually to apply it to the player.

Arguments

  • float ifps - Frame duration in seconds.

float getFov ()

Returns the current field of view of the player. The default is 60 degrees.

Return value

Current field of view in degrees.

Math::mat4 getProjection ()

Returns the current projection matrix.

Return value

Current projection matrix.

int getViewportMask ()

Returns the current viewport mask. Object surfaces, materials, decals, lights and GUI objects will be rendered into the viewport only if their viewport mask matches the player's one (one matching bit is enough).

Return value

Viewport mask (integer, each bit of which is a mask).

const char * getPostMaterials ()

Returns names of postprocess materials applied after all other postprocess (such as HDR, DOF, etc.) are rendered.

Return value

Comma-separated list of names of postprocess materials.

void setControlled (int controlled)

Disables or enables the player controls.

Arguments

  • int controlled - 1 to disable the player controls (player stops responding to them), 0 to enable the controls.

void setPostMaterials (const char * materials)

Sets postprocess materials that are applied after all other postprocess (such as HDR, DOF, etc.) are rendered.

Arguments

  • const char * materials - Comma-separated list of names of postprocess materials.

void setUp (const Math::vec3 & up)

Sets an up direction of the player's viewport (i.e. tilt of the player's viewport).

Arguments

  • const Math::vec3 & up - New upward direction vector. The vector is normalized to 1.

float getZFar ()

Returns the current distance to the far clipping plane of the player's viewing frustum. The default is 10000 units.

Return value

Distance to the far clipping plane in units.

void setReflectionMask (int mask)

Sets a reflection mask for rendering reflections into the viewport. Reflections are rendered in the viewport if masks of reflective materials match this one.

Arguments

  • int mask - Reflection mask (integer, each bit of which is a mask).

Math::vec3 getUp ()

Returns the current up direction of the player's viewport (i.e. tilt of the player's viewport).

Return value

Upward direction vector.

void setProjection (const Math::mat4 & projection)

Sets a projection matrix.

Arguments

  • const Math::mat4 & projection - New projection matrix.

void setZNear (float znear)

Sets a distance to the near clipping plane of the player's viewing frustum. The default is 0.1 units.

Arguments

  • float znear - Distance to the near clipping plane in units. The minimum value is 0.

float getZNear ()

Returns the distance to the near clipping plane of the player's viewing frustum. The default is 0.1 units.

Return value

Distance to the near clipping plane in units.

Ptr<Camera> getCamera ()

Return value

void setFov (float fov)

Sets a field of view of the player. The default is 60 degrees.

Arguments

  • float fov - Field of view in degrees. The provided value will be saturated in the range [0; 180].

int getReflectionMask ()

Returns the current reflection mask used for rendering reflections into the viewport. Reflections are rendered in the viewport if masks of reflective materials match this one.

Return value

Reflection mask (integer, each bit of which is a mask).

Ptr<Controls> getControls ()

Returns a Controls smart pointer that holds settings of input controls relevant to the player.

Return value

Controls smart pointer used to handle input controls.

void setZFar (float zfar)

Sets a distance to the far clipping plane of the player's viewing frustum. The default is 10000 units.

Arguments

  • float zfar - Distance to the far clipping plane in units. The minimum value is 0.

int isControlled ()

Returns a value indicating whether player controls are disabled (player does not respond to them) or enabled.

Return value

1 if player controls are disabled; otherwise, 0.

int getReverbMask ()

Returns the reverb mask that determines reverberation zones, which can be heard. For sound to reverberate, at least one bit of this mask should match with a reverb mask of the sound source and a reverb mask of the reverberation zone. Masks of a sound source and reverberation zone can match with the player's one in different bits, not necessarily one.

Return value

Reverb mask (integer, each bit of which is a mask for reverberating sound sources and reverberation zones).

void setControls (const Ptr<Controls> & controls)

Sets a Controls smart pointer that will hold settings of input controls relevant to the player.

Arguments

  • const Ptr<Controls> & controls - Controls smart pointer used to handle input controls.

getViewDirection ()

setViewDirection (const Math::vec3 & direction)

Arguments

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