Controllers

Description

This is a JavaScript library and is not included by default. To use the method(s) below, you must first include the library.

Example

Include this library in your script.

Script.include("/~/system/libraries/controllers.js");

Methods

Name Return Value Summary
getControllerWorldLocation Controllers.controllerWorldLocation

controllerWorldLocation is where the controller would be, in-world, with an added offset

Type Definitions

controllerWorldLocation
Type: Object

 

Properties

Name Type Summary
position Vec3

The position of the controller, relative to the world

translation Vec3

Deprecated: Use position instead.

orientation Quat

The orientation of the controller, relative to the world

rotation Quat

Deprecated: Use orientation instead.

valid boolean

Method Details

(static) getControllerWorldLocation( handController, doOffset ) → {Controllers.controllerWorldLocation}
Returns: Controllers.controllerWorldLocation

controllerWorldLocation is where the controller would be, in-world, with an added offset

Parameters

Name Type Description
handController Controller.Standard

Which hand controller? LeftHand or RightHand.

doOffset boolean

true if returned position should be offset, so the grab position is in front of hand

Example

Get the controllerWorldPosition and print it to log.

Script.include("/~/system/libraries/controllers.js");

const controllerWorldLocation = getControllerWorldLocation(Controller.Standard.LeftHand, true);

print(controllerWorldLocation);