Skip to content
Merged
Show file tree
Hide file tree
Changes from 25 commits
Commits
Show all changes
39 commits
Select commit Hold shift + click to select a range
0bfb5b0
Create ArcballControls.html
danielefornari Jun 15, 2021
4330b5e
Create misc_controls_interactivecontrolscomparison.html
danielefornari Jun 15, 2021
6cac352
Updated with interactivecontrolscomparison
danielefornari Jun 15, 2021
488b85b
Updated with ArcballControls doc
danielefornari Jun 15, 2021
96d60eb
Updated with interactivecontrolscomparison
danielefornari Jun 15, 2021
f2f53f4
Create ArcballControls.html
danielefornari Jun 15, 2021
00a9fd0
Create misc_controls_interactivecontrolscomparison.jpg
danielefornari Jun 15, 2021
8b37fd5
Create ArcballControls.js
danielefornari Jun 15, 2021
768df7b
Updated documentation
cignoni Jun 15, 2021
1d6d21f
Added copy/paste state functions
danielefornari Jun 15, 2021
79102d6
Added copy/paste functions in arcball menu
danielefornari Jun 15, 2021
60b568b
Merge branch 'dev' of https://github.com/danielefornari/three.js into…
danielefornari Jun 15, 2021
b70c7f9
Fixed copy/paste state functions
danielefornari Jun 15, 2021
38e7337
Fixed controls switch and updated arcball options gui
danielefornari Jun 15, 2021
b2888ee
Updated documentation
danielefornari Jun 15, 2021
2a09488
Added copy and paste state functions
danielefornari Jun 15, 2021
3aa9343
Rename misc_controls_interactivecontrolscomparison.html to misc_contr…
danielefornari Jun 15, 2021
be88dcc
Renamed interactivecontrolscomparison to arcball
danielefornari Jun 15, 2021
8d537cc
Update files.json
danielefornari Jun 15, 2021
ade3215
Delete misc_controls_interactivecontrolscomparison.jpg
danielefornari Jun 15, 2021
875f8e3
Merge branch 'dev' of https://github.com/danielefornari/three.js into…
danielefornari Jun 15, 2021
0176ea7
Create misc_controls_arcball.jpg
danielefornari Jun 15, 2021
347ee92
Fixed Perspective to Orthographic camera transition
danielefornari Jun 15, 2021
dd2396b
Removed unused variables and minor optimizations
danielefornari Jun 15, 2021
cedc9d6
Fixed issue with pasteState function
danielefornari Jul 19, 2021
ca73102
Merge branch 'mrdoob:dev' into dev
danielefornari Jul 29, 2021
481c9af
Replaced Hammer.js with PointerEvents
danielefornari Jul 30, 2021
eb9fd7b
Fixed double tap issue
danielefornari Aug 2, 2021
454f7a8
Fixed double tap issue
danielefornari Aug 2, 2021
95d6767
Fixed an issue causing a singlepan detection when releasing two finge…
danielefornari Aug 3, 2021
ed4f1e7
Fixed page scrolling issue
danielefornari Aug 12, 2021
19b19e1
Merge branch 'mrdoob:dev' into dev
danielefornari Aug 12, 2021
9bd2026
Fixed an issue with rotation animation
danielefornari Aug 23, 2021
ef7ba61
Merge branch 'mrdoob:dev' into dev
danielefornari Aug 23, 2021
52af65b
Updated example screenshot
danielefornari Aug 23, 2021
121900e
removed PMREMGenerator component
danielefornari Aug 23, 2021
43387d8
Added functions to add/remove operation-mouse/key association and fix…
danielefornari Sep 6, 2021
766c44d
Merge branch 'mrdoob:dev' into dev
danielefornari Sep 6, 2021
89cee6c
Modified default mouse actions
danielefornari Sep 9, 2021
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
251 changes: 251 additions & 0 deletions docs/examples/en/controls/ArcballControls.html
Original file line number Diff line number Diff line change
@@ -0,0 +1,251 @@
<!DOCTYPE html>
<html lang="en">
<head>
<meta charset="utf-8" />
<base href="../../../" />
<script src="page.js"></script>
<link type="text/css" rel="stylesheet" href="page.css" />
</head>
<body>
<h1>[name]</h1>

<p class="desc">
Arcball controls allow the camera to be controlled by a virtual trackball with full touch support and advanced navigation functionality. <br>
Cursor/finger positions and movements are mapped over a virtual trackball surface
represented by a gizmo and mapped in intuitive and consistent camera movements.
Dragging cursor/fingers will cause camera to orbit around the center of the trackball in a conservative way (returning to the starting point
will make the camera to return to its starting orientation).<br><br>

In addition to supporting pan, zoom and pinch gestures, Arcball controls provide <i>focus</i> functionality with a double click/tap for
intuitively moving the object's point of interest in the center of the virtual trackball.
Focus allows a much better inspection and navigation in complex environment.
Moreover Arcball controls allow FOV manipulation (in a vertigo-style method) and z-rotation.
Saving and restoring of Camera State is supported also through clipboard
(use ctrl+c and ctrl+v shortcuts for copy and paste the state).<br><br>

Unlike [page:OrbitControls] and [page:TrackballControls], [name] doesn't require [page:.update] to be called externally in an animation loop when animations
are on.<br><br>


To use this, as with all files in the /examples directory, you will have to
include the file separately in your HTML.

</p>

<h2>Code Example</h2>

<code>
const renderer = new THREE.WebGLRenderer();
renderer.setSize( window.innerWidth, window.innerHeight );
document.body.appendChild( renderer.domElement );

const scene = new THREE.Scene();

const camera = new THREE.PerspectiveCamera( 45, window.innerWidth / window.innerHeight, 1, 10000 );

const controls = new ArcballControls( camera, renderer.domElement, scene );

controls.addEventListener( 'change', function () {

renderer.render( scene, camera );

} );

//controls.update() must be called after any manual changes to the camera's transform
camera.position.set( 0, 20, 100 );
controls.update();
</code>

<h2>Examples</h2>

<p>[example:misc_controls_arcball misc / controls / arcball ]</p>

<h2>Constructor</h2>

<h3>[name]( [param:Camera camera], [param:HTMLDOMElement domElement], [param:Scene scene] )</h3>
<p>
[page:Camera camera]: (required) The camera to be controlled. The camera must not be a child of another object, unless that object is the scene itself.<br><br>

[page:HTMLDOMElement domElement]: The HTML element used for event listeners.<br><br>

[page:Scene scene]: The scene rendered by the camera. If not given, gizmos cannot be shown.
</p>

<h2>Events</h2>

<h3>change</h3>
<p>
Fires when the camera has been transformed by the controls.
</p>

<h3>start</h3>
<p>
Fires when an interaction was initiated.
</p>

<h3>end</h3>
<p>
Fires when an interaction has finished.
</p>

<h2>Properties</h2>

<h3>[property:Boolean adjustNearFar]</h3>
<p>
If true, camera's near and far values will be adjusted every time zoom is performed trying to mantain the same visible portion
given by initial near and far values ( [page:PerspectiveCamera] only ).
Default is false.
</p>

<h3>[property:Camera camera]</h3>
<p>
The camera being controlled.
</p>

<h3>[property:Boolean cursorZoom]</h3>
<p>
Set to true to make zoom become cursor centered.
</p>

<h3>
[property:Float dampingFactor]</h3>
<p>
The damping inertia used if [page:.enableAnimations] is set to true.
</p>

<h3>[property:HTMLDOMElement domElement]</h3>
<p>
The HTMLDOMElement used to listen for mouse / touch events. This must be passed in the constructor; changing it here will
not set up new event listeners.
</p>

<h3>[property:Boolean enabled]</h3>
<p>
When set to *false*, the controls will not respond to user input. Default is *true*.
</p>

<h3>[property:Boolean enableAnimations]</h3>
<p>
Set to true to enable animations for rotation (damping) and focus operation. Default is true.
</p>

<h3>[property:Boolean enableGrid]</h3>
<p>
When set to true, a grid will appear when panning operation is being performed (desktop interaction only). Default is false.
</p>

<h3>[property:Boolean enablePan]</h3>
<p>
Enable or disable camera panning. Default is true.
</p>

<h3>[property:Boolean enableRotate]</h3>
<p>
Enable or disable camera rotation. Default is true.
</p>

<h3>[property:Boolean enableZoom]</h3>
<p>
Enable or disable zooming of the camera.
</p>

<h3>[property:Float focusAnimationTime]</h3>
<p>
Duration time of focus animation.
</p>

<h3>[property:Float maxDistance]</h3>
<p>
How far you can dolly out ( [page:PerspectiveCamera] only ). Default is Infinity.
</p>

<h3>[property:Float maxZoom]</h3>
<p>
How far you can zoom out ( [page:OrthographicCamera] only ). Default is Infinity.
</p>

<h3>[property:Float minDistance]</h3>
<p>
How far you can dolly in ( [page:PerspectiveCamera] only ). Default is 0.
</p>

<h3>[property:Float minZoom]</h3>
<p>
How far you can zoom in ( [page:OrthographicCamera] only ). Default is 0.
</p>

<h3>[property:Float scaleFactor]</h3>
<p>
The scaling factor used when performing zoom operation.
</p>

<h3>[property:Scene scene]</h3>
<p>
The scene rendered by the camera.
</p>

<h3>[property:Float wMax]</h3>
<p>
Maximum angular velocity allowed on rotation animation start.
</p>


<h2>Methods</h2>

<h3>[method:null activateGizmos] ( [param:Boolean isActive] )</h3>
<p>
Make gizmos more or less visible.
</p>

<h3>[method:null copyState] ()</h3>
<p>
Copy the current state to clipboard (as a readable JSON text).
</p>

<h3>[method:null dispose] ()</h3>
<p>
Remove all the event listeners, cancel any pending animation and clean the scene from gizmos and grid.
</p>

<h3>[method:null pasteState] ()</h3>
<p>
Set the controls state from the clipboard, assumes that the clipboard stores a JSON text as saved from [page:.copyState].
</p>

<h3>[method:null reset] ()</h3>
<p>
Reset the controls to their state from either the last time the [page:.saveState] was called, or the initial state.
</p>

<h3>[method:null saveState] ()</h3>
<p>
Save the current state of the controls. This can later be recovered with [page:.reset].
</p>

<h3>[method:null setCamera] ( [param:Camera camera] )</h3>
<p>
Set the camera to be controlled. Must be called in order to set a new camera to be controlled.
</p>

<h3>[method:null setGizmosVisible] ( [param:Boolean value] )</h3>
<p>
Set the visible property of gizmos.
</p>

<h3>[method:null setTarget] ( [param:Float x], [param:Float y], [param:Float z] )</h3>
<p>
Set the trackball center point.
</p>

<h3>[method:null update] ()</h3>
<p>
Update the controls. Must be called after any manual changes to the camera's transform.
</p>

<h2>Source</h2>

<p>
[link:https://github.com/mrdoob/three.js/blob/master/examples/jsm/controls/OrbitControls.js examples/jsm/controls/ArcballControls.js]
</p>
</body>
</html>
1 change: 1 addition & 0 deletions docs/list.json
Original file line number Diff line number Diff line change
Expand Up @@ -338,6 +338,7 @@
},

"Controls": {
"ArcballControls": "examples/en/controls/ArcballControls",
"DeviceOrientationControls": "examples/en/controls/DeviceOrientationControls",
"DragControls": "examples/en/controls/DragControls",
"FirstPersonControls": "examples/en/controls/FirstPersonControls",
Expand Down
1 change: 1 addition & 0 deletions examples/files.json
Original file line number Diff line number Diff line change
Expand Up @@ -373,6 +373,7 @@
"misc_animation_groups",
"misc_animation_keys",
"misc_boxselection",
"misc_controls_arcball",
"misc_controls_deviceorientation",
"misc_controls_drag",
"misc_controls_fly",
Expand Down
Loading