Sign Up

Sign Up to our social questions and Answers Engine to ask questions, answer people’s questions, and connect with other people.

Have an account? Sign In

Have an account? Sign In Now

Sign In

Login to our social questions & Answers Engine to ask questions answer people’s questions & connect with other people.

Sign Up Here

Forgot Password?

Don't have account, Sign Up Here

Forgot Password

Lost your password? Please enter your email address. You will receive a link and will create a new password via email.

Have an account? Sign In Now

You must login to ask a question.

Forgot Password?

Need An Account, Sign Up Here

Please briefly explain why you feel this question should be reported.

Please briefly explain why you feel this answer should be reported.

Please briefly explain why you feel this user should be reported.

Sign InSign Up

The Archive Base

The Archive Base Logo The Archive Base Logo

The Archive Base Navigation

  • Home
  • SEARCH
  • About Us
  • Blog
  • Contact Us
Search
Ask A Question

Mobile menu

Close
Ask a Question
  • Home
  • Add group
  • Groups page
  • Feed
  • User Profile
  • Communities
  • Questions
    • New Questions
    • Trending Questions
    • Must read Questions
    • Hot Questions
  • Polls
  • Tags
  • Badges
  • Buy Points
  • Users
  • Help
  • Buy Theme
  • SEARCH
Home/ Questions/Q 9203043
In Process

The Archive Base Latest Questions

Editorial Team
  • 0
Editorial Team
Asked: June 17, 20262026-06-17T23:23:26+00:00 2026-06-17T23:23:26+00:00

I have a scene which renders a board with several objects. Clicking on one

  • 0

I have a scene which renders a board with several objects. Clicking on one of the objects and by use of object picking I can get the object and animate the cameras position to sit in an ‘overhead’ view of the object. Then using the camera.lookAt method I can force the camera to look directly at the object.

I am noticing a quick jump at the start of my animation when calling camera.lookAt within the onUpdate method as it initially has a large distance to rotate to look at the object selected. Each subsequent call to camera.lookAt is tiny in comparison and is animated nicely.

// Position the camera to fit
var tween = new TWEEN.Tween(camera.position).to({
    x: selectedObject.position.x,
    y: selectedObject.position.y,
    z: 1
}).easing(TWEEN.Easing.Quadratic.InOut).onUpdate(function() {
    camera.lookAt(selectedObject.position);
}).onComplete(function() {
    camera.lookAt(selectedObject.position);
}).start();

Is there any way to animate the method or will I have to manually transform the matrix values of the camera to look at my selected object?

Here is a fiddle with an example. It uses WebGLRenderer so please use a suitable browser.

http://jsfiddle.net/fungus1487/SMLwa/

Thanks for any help.

  • 1 1 Answer
  • 0 Views
  • 0 Followers
  • 0
Share
  • Facebook
  • Report

Leave an answer
Cancel reply

You must login to add an answer.

Forgot Password?

Need An Account, Sign Up Here

1 Answer

  • Voted
  • Oldest
  • Recent
  • Random
  1. Editorial Team
    Editorial Team
    2026-06-17T23:23:26+00:00Added an answer on June 17, 2026 at 11:23 pm

    One thing you can do is tween both the camera position and the camera target (which you have to define).

    var tween = new TWEEN.Tween( camera.position )
        .to( {
            x: selectedObject.position.x,
            y: selectedObject.position.y,
            z: 1
        } )
        .easing( TWEEN.Easing.Linear.None ).onUpdate( function () {
    
            camera.lookAt( camera.target );
    
        } )
        .onComplete( function () {
    
            camera.lookAt( selectedObject.position );
    
        } )
        .start();
    
    var tween = new TWEEN.Tween( camera.target )
        .to( {
            x: selectedObject.position.x,
            y: selectedObject.position.y,
            z: 0
        } )
        .easing( TWEEN.Easing.Linear.None )
        .onUpdate( function () {
    
        } )
        .onComplete( function () {
    
            camera.lookAt( selectedObject.position );
    
        } )
        .start();
    

    It’s a little tricky, because the tween’s need to run exactly concurrently, and they don’t…
    This is the reason for the camera.lookAt() call in the second tween.

    • 0
    • Reply
    • Share
      Share
      • Share on Facebook
      • Share on Twitter
      • Share on LinkedIn
      • Share on WhatsApp
      • Report

Sidebar

Related Questions

I have a textured object in my OpenGL ES scene (version 1.1) for which
I have a scene and an object placed in some coordinates. I can transform
I have an OpenGL ES scene which is made up of about 20 objects.
I have an OpenGL scene in which the user can rotate the camera. I
I have code which is something like this: osgViewer::Viewer viewer; viewer.setSceneData(scene); viewer.setCameraManipulator( tracker.get() );
I am rendering a scene in which I have two spheres. I am revolving
I have some GUI-like elements in my WebGL scene which have to be displayed
I have the following structure that works and renders a direct x scene to
I have a simple solid modeling application in which I want to implement several
I have a one big Sprite on the Scene - for example 200x200 and

Explore

  • Home
  • Add group
  • Groups page
  • Communities
  • Questions
    • New Questions
    • Trending Questions
    • Must read Questions
    • Hot Questions
  • Polls
  • Tags
  • Badges
  • Users
  • Help
  • SEARCH

Footer

© 2021 The Archive Base. All Rights Reserved
With Love by The Archive Base

Insert/edit link

Enter the destination URL

Or link to existing content

    No search term specified. Showing recent items. Search or use up and down arrow keys to select an item.