Author Topic: Disable cameraLookAt  (Read 4692 times)

Offline Ackastar

  • byte
  • *
  • Posts: 1
    • View Profile
Disable cameraLookAt
« on: January 13, 2023, 04:21:30 pm »
Essentially I have a camera looking at and following a vehicle as it moves around in 3d space and sometimes I'd like to disable the lookat and start a freecam.
i.e turn of the cameraLookAt temporarily to be able to move around by translating the cameras position, maintaining its rotation.

I've so far tried to create a distant point to replace cameraLookAt(vehicle) with cameraLookAt(distantDummy) but im not quite satisfied with the solution.

Has anyone done anthing similar?

Thanks

Offline AeroShark333

  • float
  • ****
  • Posts: 319
    • View Profile
Re: Disable cameraLookAt
« Reply #1 on: January 13, 2023, 07:19:15 pm »
I'd temporarily store/clone the RotationMatrix of the camera on the moment you enable the freecam. This means you'll have the last known camera rotation matrix which was used when the camera used #lookAt(...). Then instead of doing #lookAt(distantDummy), you do #setRotationMatrix(temporaryMatrix)