FollowCamera setTarget does not accept mesh

According to the documentation, ArcFollowCamera (and FollowCamera, maybe others too?) setTarget() method should be able to accept either a vector or a mesh, but it only accepts a vector. Therefore the only way I see to set mesh as target is to do it in the constructor. The ArcRotateCamera setTarget() does accept either a mesh or a vector.

(BTW, BabylonJS rocks!)

Thanks!

Here is the small example with switching camera targets - Babylon.js Playground
As it is written in Documentation, setTarget method accepts Vector3 parameters.
To set mesh as a target you may use mesh.position

It does feel, however, that the Follow cameras should have a setTargetMesh function.

I also believe he refers to the documentation mistake of the TargetCamera’s setTarget function that states “mesh or vector”, but accepts only Vector3. In this case - it is a documentation mistake. We accepts PRs to solve this :slight_smile:

2 Likes