GithubHelp home page GithubHelp logo

Comments (2)

yomotsu avatar yomotsu commented on August 22, 2024

The function applyCameraUp triggers several calculations, as seen here:

applyCameraUp():void {
const cameraDirection = _v3A.subVectors( this._target, this._camera.position ).normalize();
// So first find the vector off to the side, orthogonal to both this.object.up and
// the "view" vector.
const side = _v3B.crossVectors( cameraDirection, this._camera.up );
// Then find the vector orthogonal to both this "side" vector and the "view" vector.
// This vector will be the new "up" vector.
this._camera.up.crossVectors( side, cameraDirection ).normalize();
this._camera.updateMatrixWorld();
const position = this.getPosition( _v3A );
this.updateCameraUp();
this.setPosition( position.x, position.y, position.z );
}

I am concerned that making it animatable within the tick function might lead to performance issues.
Typically, changing the camera's up direction is uncommon in regular usage, so it might be more efficient to handle this as a separate function and call it only when necessary.

What are your thoughts on this approach?

from camera-controls.

ShaydeNZ avatar ShaydeNZ commented on August 22, 2024

I've also had some issues with this. For me it's mostly about updateCameraUp().

I use a six view system, where a view looking along each axis can be selected. Moving to a view that looks directly towards the previous camera up requires me to change the camera up so that camera orbiting does something useful. So I select a new camera up vector, do an updateCameraUp(), then perform a setLookAt() with a transition.

On the surface, this is fine, as setLookAt only uses the new _yAxisUpSpace to set _sphericalEnd. But it seems the update() function also uses _yAxisUpSpace during the transition, even though the original orientation was built with the previous camera up value. So the transition "snaps" then moves.

Not a biggie really, as I just don't use a transition if I change the camera's up value. Just mentioning it as it may not be such an obscure request as it may seem. Not sure of an easy solution to it though, given the update() function's reliance on _yAxisUpSpace.

from camera-controls.

Related Issues (20)

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    🖖 Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo D3

    Bring data to life with SVG, Canvas and HTML. 📊📈🎉

Recommend Topics

  • javascript

    JavaScript (JS) is a lightweight interpreted programming language with first-class functions.

  • web

    Some thing interesting about web. New door for the world.

  • server

    A server is a program made to process requests and deliver data to clients.

  • Machine learning

    Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google ❤️ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.