PhysicalObject3D

PhysicalObject3D

The PhysicalObject3D is the base class for physical game objects

Constructor

new PhysicalObject3D(gameEngine, options, props)

Creates an instance of a physical object. Override to provide starting values for position, velocity, quaternion and angular velocity. NOTE: all subclasses of this class must comply with this constructor signature. This is required because the engine will create temporary instances when syncs arrive on the clients.

Parameters:
Name Type Description
gameEngine GameEngine

the gameEngine this object will be used in

options Object

options for the new object. See GameObject

props Object

properties to be set in the new object

Properties
Name Type Description
position ThreeVector

position vector

velocity ThreeVector

velocity vector

quaternion Quaternion

orientation quaternion

angularVelocity ThreeVector

3-vector representation of angular velocity

Source:

Members

(static) netScheme :Object

The netScheme is a dictionary of attributes in this game object. The attributes listed in the netScheme are those exact attributes which will be serialized and sent from the server to each client on every server update. The netScheme member is implemented as a getter.

You may choose not to implement this method, in which case your object only transmits the default attributes which are already part of PhysicalObject3D. But if you choose to add more attributes, make sure the return value includes the netScheme of the super class.

Source:
Example
static get netScheme() {
      return Object.assign({
          mojo: { type: BaseTypes.TYPES.UINT8 },
        }, super.netScheme);
    }

Methods

toString() → {String}

Formatted textual description of the dynamic object. The output of this method is used to describe each instance in the traces, which significantly helps in debugging.

Source:
Returns:

description - a string describing the PhysicalObject3D

Type
String