Created
October 23, 2015 21:36
-
-
Save tomlagier/c951c601f516022240dd to your computer and use it in GitHub Desktop.
Basic snippet of code
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
this.currentlyRotating.addCubes(group); | |
let currentPosition, | |
pastPosition = ThreeHub.scene.mouse.raycaster.ray.intersectPlane(plane), | |
delta; | |
ThreeHub.$el.on('mousemove.cubeRotation', () => { | |
currentPosition = ThreeHub.scene.mouse.raycaster.ray.intersectPlane(plane); | |
delta = currentPosition[deltaAxis] - pastPosition[deltaAxis]; | |
console.log({ | |
delta, | |
deltaAxis, | |
rotationAxis, | |
plane | |
}); | |
//PERFORM SOME TRANSLATION HERE DEPENDING ON THE PLANE, DELTA AXIS, AND ROTATION AXIS | |
this.currentlyRotating.rotation[rotationAxis] -= delta; | |
pastPosition.set(currentPosition.x, currentPosition.y, currentPosition.z); | |
}); |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment