# PlayerPersecutor Class

This class is used to create a free flying camera without a physical body that follows the target node at the specified distance. The exact point of the target it follows is called an anchor. The persecutor can either turn around its target or its viewing direction can be fixed. Just like PlayerSpectator it is approximated with a sphere, which allows it to collide with objects (but it cannot, for example, to push or interact with them).

## PlayerPersecutor Class

This class inherits from Player### Members

## PlayerPersecutor ()

Constructor. Creates a new persecutor with default properties.## vec3 getAnchor ()

Returns coordinates of an anchor point (in the target node local coordinates), to which the persecutor is bound. The default is*.*

**vec3(0.0)**### Return value

Anchor coordinates.## int getCollisionMask ()

Returns a collision mask of the persecutor's collision sphere. Two objects collide, if they both have matching masks. The default is**1**.

### Return value

Integer, each bit of which is a mask.## float getCollisionRadius ()

Returns radius of the persecutor's collision sphere. The default is**0.5**.

### Return value

Radius of the collision sphere in units.## int getCollision ()

Returns a value indicating if collisions with persecutor's sphere should be taken into account. The default is**1**.

### Return value

Positive number if collisions are taken into account; otherwise,**0**.

## float getContactDepth (int contact)

Returns penetration depth by the given contact.### Arguments

*int*- Contact number.**contact**

### Return value

Penetration depth.## vec3 getContactNormal (int contact)

Returns a normal of the contact point, in world coordinates.### Arguments

*int*- Contact number.**contact**

### 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 number.**contact**

### Return value

Object in contact.## vec3 getContactPoint (int contact)

Returns world coordinates of the contact point.### Arguments

*int*- Contact number.**contact**

### Return value

Contact point.## Shape getContactShape (int num)

Returns a shape that collided with the player.### Arguments

*int*- Contact number.**num**

### 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 number.**contact**

### Return value

Surface number.## float getDistance ()

Returns the current distance between the target and the persecutor. The value is clamped between the minimum and the maximum distance values. The default is**1**unit.

### Return value

Distance in units.## float getMaxDistance ()

Returns the maximum possible distance between the persecutor and the target. The default is**4**units.

### Return value

Distance in units.## 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. The default is**90.0**degrees.

### Return value

Angle in degrees.## float getMinDistance ()

Returns the minimum possible distance between the persecutor and the target. The default is**1**unit.

### Return value

Distance in units.## 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. The default is**-90**degrees.

### Return value

Angle in degrees.## int getNumContacts ()

Returns the number of contacts, in which the player's capsule 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 to the right; negative values rotate it to the left.### Return value

Angle in degrees.## Node getTarget ()

Returns the object currently followed by the persecutor.### Return value

Target node.## 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. By a positive value, the player looks upwards; by a negative one - downwards. The value is clamped between the minimum and the maximum theta angle.### Return value

Angle in degrees.## float getTurning ()

Returns a velocity of player turning. The default is**90**degrees per second.

### Return value

Turning velocity in degrees per second.## vec3 getViewDirection ()

Returns the current viewing orientation of the player. The result is the same as using phi and theta angles, but this function returns a vector.### Return value

View direction vector.## int isFixed ()

Returns a value indicating if the persecutor can freely rotate around its target or it is oriented strictly in one direction. The fixed viewing direction is the same direction the persecutor was looking in when setFixed() function is called, though it can be reset to another one afterwards. The default is**0**.

### Return value

Positive number if the persecutor moves independently; otherwise,**0**.

## void setAnchor (vec3 anchor)

Sets coordinates of an anchor point (in the target node local coordinates), to which the persecutor is bound. The default is*.*

**vec3(0.0)**### Arguments

*vec3*- Anchor coordinates.**anchor**

## void setCollisionMask (int mask)

Sets a collision mask for the persecutor's collision sphere. Two objects collide, if they both have matching masks. The default is**1**.

### Arguments

*int*- Integer, each bit of which is a mask.**mask**

## void setCollisionRadius (float radius)

Sets the radius of the persecutor's collision sphere. The default is**0.5**.

### Arguments

*float*- New radius of the collision sphere.**radius**

## void setCollision (int mode)

Sets a value indicating if collisions with persecutor's sphere should be taken into account. The default is**1**.

### Arguments

*int*- Positive number to allow collisions,**mode****0**to let the persecutor fly through objects.

## void setDistance (float distance)

Sets a distance between the target node and the persecutor. The value will be clamped between the minimum and the maximum distance values.### Arguments

*float*- New distance in units.**distance**

## void setFixed (int mode)

Sets a value indicating if the persecutor can freely rotate around its target or it is oriented strictly in one direction. The fixed viewing direction is the same direction the persecutor was looking in when this function is called, though it can be reset to another one afterwards. The default is**0**.

### Arguments

*int*- Positive number to move independently,**mode****0**to follow the target.

## void setMaxDistance (float distance)

Sets the maximum possible distance between the persecutor and the target.The default is**4**units.

### Arguments

*float*- New distance in units.**distance**

## 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. The default is**90.0**degrees.

### Arguments

*float*- New angle in degrees in range [0;90]. The higher the value, the further down the player can look.**angle**

## void setMinDistance (float distance)

Sets the minimum possible distance between the persecutor and the target. The default is**1**unit.

### Arguments

*float*- New distance in units.**distance**

## 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. The default is**-90**degrees.

### Arguments

*float*- New angle in degrees in range [-90;0]. The lower the value, the further up the player can look.**angle**

## 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*- New angle in degrees. Positive values rotate the player to the right; negative values rotate it to the left.**angle**

## void setTarget (Node target)

Sets an object, which will be followed by the persecutor. The default is**NULL**.

### Arguments

*Node*- New target node.**target**

## 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*- New angle in degrees in range [**angle****-90**;**90**]. By a positive value, the player looks upward; by a negative one - downwards.

## void setTurning (float velocity)

Sets a velocity of player turning. The default is**90**degrees per second.

### Arguments

*float*- Turning velocity in degrees per second. If a negative value is provided,**velocity****0**will be used instead.

## void setViewDirection (vec3 direction)

Sets the viewing orientation of the player. The result is the same as using phi and theta angles, but this function takes a vector as an argument.### Arguments

*vec3*- View direction vector.**direction**

Last update: 2017-07-03

Help improve this article

Was this article helpful?

(or select a word/phrase and press Ctrl+Enter)