Hi Folks,
I have an issue where I’m trying to use a FollowCamera to track an object that uses billboard mode to make sure it’s always facing the camera. However, I get:
Uncaught RangeError: Maximum call stack size exceeded
I’ve got a PG reproducing this here: Babylon.js Playground
Having thought about this a bit, it makes sense. I’m trying to orient an object to the camera, and have the camera follow an object, so they’re just competing with each other over and over to do so?
Is there any other way of having a FollowCamera and making sure that the object it’s following is facing the camera?
Thanks, Tom
Maybe you can set the orientation of the mesh to the one of the camera:
https://playground.babylonjs.com/#6J5BR6#1
1 Like
Thanks, that does seems to have solved it. It seems to be causing the camera to “track” the objects much more quickly than it was doing before, but I think I can adjust the cameraAcceleration
property and get it to do the right thing.
Thanks!
I’ve ended up taking another approach which I thought I’d mention here for future travellers. I’ve added a non-visible mesh to the scene and used that as the lockedTarget for my FollowCamera. I just update the position of this non-visible mesh (which obviously doesn’t have billboard mode enabled) to be the same as the mesh I do have billboard mode on.
2 Likes