Capítulo 308 de 859
This class can be used to provide a drag'n'drop interaction.
rotate mode. The higher the number the faster the rotation.objects array contains a single draggable group object. If set to true, the controls does not transform i…const controls = new DragControls( objects, camera, renderer.domElement );
// add event listener to highlight dragged objects
controls.addEventListener( 'dragstart', function ( event ) {
event.object.material.emissive.set( 0xaaaaaa );
} );
controls.addEventListener( 'dragend', function ( event ) {
event.object.material.emissive.set( 0x000000 );
} );
Constructor
| Signature |
|---|
new DragControls( objects : Array.<Object3D>, camera : Camera, domElement : HTMLElement ) |
Properties
| Property | Description |
|---|---|
.objects : Array.<Object3D> | An array of draggable 3D objects. |
.raycaster : Raycaster | The raycaster used for detecting 3D objects. |
.recursive : boolean | Whether children of draggable objects can be dragged independently from their parent. |
.rotateSpeed : number | The speed at which the object will rotate when dragged in rotate mode. The higher the number the faster the rotation. |
.transformGroup : boolean | This option only works if the objects array contains a single draggable group object. If set to true, the controls does not transform individual objects but the entire group. |