We use cookies to ensure that we give you the best experience on our website. If you continue to use this site we will assume that you are happy with it.

Camera Interpolation

Home Forums Programming Camera Interpolation

Viewing 3 posts - 1 through 3 (of 3 total)
  • Author
    Posts
  • #65200
    ps
    Participant

    I have used v3d.SimplePreloader to load a glTF model. I want the camera to transition from its current position and lookat to a desired one on click of a button. I am able to get the current camera position and lookat and need to know how to do the camera interpolation.

    // Get the camera object from the scene
      let sceneCamera = app.scene.getObjectByName("Camera");
    
      // Calculate the camera's current position and target
      let initialPosition = sceneCamera.position.clone();
    
      let camLookAt = new v3d.Vector3();
      sceneCamera.getWorldDirection(camLookAt);
      let initialTarget = camLookAt;
    
      // Set the target position and lookat direction for the camera
      let newPosition = new v3d.Vector3(-0.1624367, 0.182233, 0.4044204);
      let newTarget = new v3d.Vector3(0.0, -0.23743, -0.9714045);

    Thanks

    #65207
    kdv
    Participant

    https://www.soft8soft.com/docs/manual/en/puzzles/Camera.html#tween_camera

    Puzzles and JS. Fast and expensive.

    If you don’t see the meaning in something it primarily means that you just don’t see it but not the absence of meaning at all.

    #65237
    ps
    Participant

    Thanks

Viewing 3 posts - 1 through 3 (of 3 total)
  • You must be logged in to reply to this topic.