Exposing quaternion of THREE.Object3D
Opened this issue · 1 comments
Hello,
I would like to be able to get the quaternion (rotation) of the camera or THREE.Object3D
in general. Essentially I want to be able to use functions like this:
import * as THREE from 'three'
export function getSideVector(object: THREE.Object3D): THREE.Vector3 {
// create default plane using normal vector
const normalVector = new THREE.Vector3(0, 1, 0)
const normalPlane = new THREE.Plane(normalVector, 0)
// copy rotation of object to plane
normalPlane.normal.set(0, 1, 0).applyQuaternion(object.quaternion.clone())
// get new normal vector
const newNormalVector = normalPlane.normal
// create new vector from cross product
const crossVector = new THREE.Vector3()
crossVector.crossVectors(newNormalVector, getForwardVector(object))
return crossVector
}
With this function I we would be able to move an object no matter its rotation perfectly sideways.
I haven't done so before, but I could try to create a pull request.
Best regards
At this point in time, the little pieces that I've picked up on from @Rich-Harris's talks/interviews is that he's focusing on svelte/svelte.kit . There's been a bunch of us waiting for this particular release for a while which is why there's a bunch of PR's already but my guess is that we should set our expectations accordingly. To be clear on my thoughts, a PR is welcome but it's probably going to take Rich some time before getting back to us.
If you haven't already seen it, here's a link to one of his talks from this playlist