Vec3D

Represents a position in a 2D or 3D space.


This class is used to express a position inside a virtual environment with no specific unit of measure (could be pixels, feet, meters, etc).

Positions along the X,Y,Z axes can be expressed as integers or floats, based on the game's coordinate system requirements.

Constructor

new Vec3D(px, py, pzopt, useFloatsopt)

Creates a new instance of the Vec3D class.

The useFloats parameter can be used to force the API to send the coordinates as floating point values when setting the user position (see the SetUserPositionRequest class) or creating an MMORoom. This must be set accordingly to the server-side setting of the MMORoom and consistently through the client.

Parameters:
NameTypeAttributesDefaultDescription
pxnumberThe position along the X axis.
pynumberThe position along the Y axis.
pznumber<optional>
0The position along the Z axis.
useFloatsboolean<optional>
falseForce the coordinates to be sent as floating point values to the server.

Members

(readonly) isFloat :boolean

Indicates whether the position is expressed using floating point values.
Type:
  • boolean

px :number

Position along the X axis.
Type:
  • number

py :number

Position along the Y axis.
Type:
  • number

pz :number

Position along the Z axis.
Type:
  • number

Methods

toString() → {string}

Returns a string containing the x, y and z coordinates.
Returns:
The string representation of the Vec3D object.
Type: 
string