Object3D

THREE. Object3D

new Object3D()

The AltspaceSDK adds Behavior capabilites to Three.js' Object3D class.

Members

userData :Object

User data for this Object3D instance. If userData has an altspace property, it will be used to set extra properties on the object that are used by the Altspace renderer.

Properties:
Name Type Description
altspace THREE.Object3D~AltspaceFlags

Altspace-specific properties associated with this object.

Methods

addBehavior(behavior)

Adds the given behavior to this object.

Parameters:
Name Type Description
behavior Behavior

Behavior to add.

addBehaviors(…behavior)

Adds the given behaviors to this object.

Parameters:
Name Type Attributes Description
behavior Behavior <repeatable>

Behavior to add.

getBehaviorByType(type) → {Behavior}

Retrieve a behavior by type.

Parameters:
Name Type Description
type String

removeAllBehaviors()

Removes all behaviors from this object. The behaviors are disposed if possible.

removeBehavior(…behavior)

Removes the given behavior from this object. The behavior is disposed if possible.

Parameters:
Name Type Attributes Description
behavior Behavior <repeatable>

Behavior to remove.

updateBehaviors(deltaTime)

Update behaviors on this object.

Parameters:
Name Type Description
deltaTime Number

Elapsed time in milliseconds

Type Definitions

ThreeJSCursorEvent

The ThreeJSCursorEvent interface represents events that occur due to the user interacting with three.js objects using the cursor

Properties:
Name Type Description
ray THREE.Ray

The ray that was used to project the cursor. Will often come from either the user's center eye or a motion controller they are holding.

point THREE.Vector3

The point in world space where the ray intersected an object.

bubbles Boolean

Whether this event will bubble up the three.js hierarchy. True for all ThreeJSCursorEvents. Roughly matches DOM bubbling (does not have a capture step).

target THREE.Object3D

The THREE.Object3D the event originally fired on.

currentTarget THREE.Object3D

The THREE.Object3D the event is currently firing on as it bubbles.

stopPropagation function

Allows the remaining event listeners for this event on this THREE.Object3D to fire and then stops.

stopImmediatePropagation function

Stops the firing of any more event listeners for this event.

AltspaceFlags

Altspace-specific properties associated with an Object3D instance via the userData.altspace property.

Properties:
Name Type Description
collider Object

Properties for the collider (hitbox) associated with the Object3D

Properties
Name Type Attributes Default Description
enabled Boolean <optional>
true

If set to false, the Altspace cursor will not collide with this object.

Events

cursordown

The cursordown event is fired from an THREE.Object3D when the user's primary cursor button is pressed down over an object

Type:

cursorenter

The cursorenter event is fired from an THREE.Object3D when the user's cursor moves over the object.

Type:

cursorleave

The cursorleave event is fired from an THREE.Object3D when the user's cursor moves off the object.

Type:

cursorup

The cursorup event is fired from an THREE.Object3D when the user's primary cursor button is lifted up over an object

Type: