Namespace for the module. Has a few methods:
Returns a GUI Object.
const gui = dat.GUIVR.create( name );
Takes any object3D and returns an Input (laser pointer) for dat.GUIVR.
THREE.Object3D
object (mesh, group, camera, etc)This adds a camera as an input object.
const gazeInput = dat.GUIVR.addInputObject( camera );
This adds a Vive controller as an input object.
const guiInputRight = dat.GUIVR.addInputObject( controllers[ 0 ] );
Once created, you must add it to your scene to be visible
scene.add( guiInputRight );
See Input Objects.
.enableMouse() / .disableMouse()Enables or disables mouse interaction.
Each GUI is a self contained list of controllers that can be moved around and minimized.
.add( object, property, arg3, arg4, ... )Creates a new controller and returns it. See controllers and controllers and how to create them.
Each type of Controller has its own methods and properties. See Slider Controller, Dropdown Controller, Checkbox Controller, and Button Controller.
gui.add( object, 'numericProperty', min, max );
This creates a Slider Controller that manipulates object.numericProperty.
Adds a stateless slider controller where the value is implicit. Equivalent to doing:
gui.add( {x:0}, 'x', min, max );
Adds a stateless dropdown controller. Equivalent to doing:
gui.add( {option:''}, [options...] );
Adds a stateless checkbox controller. Equivalent to doing:
gui.add( {flag: false}, 'flag' );
Adds a stateless button controller. Equivalent to doing:
`gui.add( {f:function(){...}}, 'f' );
An input object represents the laser pointer for how you interact with dat.GUIVR. It's created when you add an input:
const guiInputRight = dat.GUIVR.addInputObject( controllers[ 0 ] );
An Input Object is a actually an Object3D, which means you can attach it to the scene for it to be rendered:
scene.add( guiInputRight );
You can also attach other things to it if you want:
guiInputRight.add( light );
The Input Object has the following properties and methods:
A mesh representing where the laser pointer of the input ends.
.pressed( flag ) and .gripped( flag )Manually set button presses for the input. Pressed represents a click or a Vive trigger pull. Gripped is when you squeeze the grip button on the Vive controller. This is used when you want to bind custom inputs (like gaze) to activate dat.GUIVR.
See Input Support for more details.
document.addEventListener( 'mousedown', function(){ input.pressed( true ); } );
Sets a callback that will be run whenever the value changes via interaction with the controller. The function will have an argument for the updated value. Called every frame when updating the value.
Makes the controller update itself based on changes to the object property.
Sets the label for the controller.
Sets the min value for this slider.
Sets the max value for this slider.
Sets the "step" value for this slider. For example at step 1, the slider will only increment at integers (0, 1, 2, 3, up to max). At step 0.1, the slider will only increment at 0.1 steps (0, 0.1, 0.2, etc).
const state = {
size: 12
};
var slider = gui.add( state, 'size', 0, 30 ).step( 0.1 ).onChange( function( value ){
mesh.scale.setScalar( value );
});
Sets a callback that will be run whenever the value changes via interaction with the controller. The function will have an argument for the updated value. Called every frame when updating the value.
Makes the controller update itself based on changes to the object property.
Sets the label for the controller.
const state = {
colors: ['0xff0000', '0x00ff00', '0x0000ff']
};
var dropdown = gui.add( state, 'colors' ).onChange( function( color ){
material.color.setHex( color );
});
Sets a callback that will be run whenever the value changes via interaction with the controller. The function will have an argument for the updated value. Called every frame when updating the value.
Makes the controller update itself based on changes to the object property.
Sets the label for the controller.
const state = {
wireframe: false
};
var dropdown = gui.add( state, 'wireframe' ).onChange( function( flag ){
material.wireframe = flag;
});
Sets the label for the controller.
const state = {
reset: function(){
console.log( 'reset' );
}
};
var button = gui.add( state, 'reset' );
RetroSearch is an open source project built by @garambo | Open a GitHub Issue
Search and Browse the WWW like it's 1997 | Search results from DuckDuckGo
HTML:
3.2
| Encoding:
UTF-8
| Version:
0.7.4