Hi P, sorry for the slow weekend replies.
Many or all BJS cameras have a .target and .lockedTarget properties, and often, they can be EITHER a mesh OR a Vector3 value.
Check out this playground: https://www.babylonjs-playground.com/#LN7YVL#4
Line 7… a standard freeCamera… but in line 25, AFTER the cylinder has been created… we can set the freeCamera .lockedTarget = cylinder. Mouse dragging turns-off because targeting is automated. But, notice that the arrow keys still change the position of the camera itself. The lockedTarget item remains the aim-at target.
Now let’s play with the ArcRotateCamera .lockedTarget. Disable line 7 freeCamera, and activate line 8 standard ArcRotateCamera. Leave line 25 as it is. Click run.
For this method, camera-drag with mouse… still “orbits” around target, like any good ArcCam, and arrow keys do the same. With no camera mouse or arrow keys camera.inputs… camera stays orbit-oriented to its lockedTarget. (a little different from the freeCamera)
And… most/all BJS cameras… allow you to change or remove “keys” property, and/or empty the camera.inputs array… removing player control, if wanted.
.target is almost as much fun as .lockedTarget, but you might need to do camera.target = cylinder
… constantly, inside the scene’s render-loop, to get same affect as using .lockedTarget.
To make some code operate (repeatedly and fast) within the scene’s render-loop, many programmers use this method:
scene.onBeforeRenderObservable.add(function () {
your code here - runs once per render frame;
});
Do some experiments on various camera .target and .lockedTarget, even on the followCamera. There’s lots to be learned and plenty of fun, too.
FYI: I THINK… .noRotationConstraint … allows/prevents cameras from becoming upside-down. A within-playground-code SEARCH for noRotationConstraint… will show some examples of usage.
I hope this helps. Ask more things, comment at will, mark as solved, if you wish, we’re here to help, even if we are a bit slow on the weekends.