Follow Camera + animation groups

Hey Guys, i have a scene with a imported glb model that was animated in blender, and i would like to figure out how to make the follow camera follow the model.

I was fiddling around a lot till i realised that the model mesh position stays the same, and in follow camera examples you always see mesh position changing. And in my case, i suppose the animation groups are what changes the model’s position?

Would anyone know if this line of thought is correct and how would one solve it?
https://www.babylonjs-playground.com/#SQ5UC1#123 (you have to zoom out a bit to see the stage and the model)

thanks in advance!

Hi N… sorry for the lack of replies. Were you able to find another solution?

I think I understand the issue. When a model’s position never changes, and it is instead animated via transforming (moving/scaling) the model’s vertex coordinates (often called positionKind), the followCamera doesn’t know what/how to follow.

There’s really two possible solutions… neither are “graceful” or necessarily wise.

  1. Overload/modify the followCamera to ALLOW a vertex (or a group of vertices who have their positionKind data “averaged”/“summed”)… to be used as a followCam target. This would require some model positionKind data querying/preprocessing… prior to each followCamera update. (yech)

  2. Somehow “attach” an invisible basic primitive (like a sphere or box) onto a vertex or group of averaged vertices of the model. In other words, somehow attach a “legal followCam target”… to the animated vertices of the model. (another yech).

Let’s listen for more comments. Yes, I know, I know, you have been listening for comments for a LONG time… sorry about that.

This is an interesting issue/topic. Your use-case MIGHT BE substantiation/justification… to modify/enhance the BJS followCamera… to allow it to follow a vertex (a positionKind value).

Perhaps followCameras SHOULD have dual “target modes”. Follow the target’s position, or follow the target’s 5th vertex (for example). hmm… worthy of a good beard-scratching.

I think standard followCamera’s also deal-with target rotation, and that characteristic is not available when following a single animated vertex. BUT, rotational data COULD be available… IF the target were a GROUP of vertices… perhaps. That’s not an easy calculation, though.

Calculating if/how a GROUP of vertices has rotated during a frame of vertex animation… “feels” beyond the intelligence of a followCamera, and could easily bog-down the camera’s follow-updating.

Have I analyzed this TO DEATH, yet? :slight_smile: @nejurgis… I think you deserve an in-depth pondering… considering you’ve waited patiently for SO LONG. You sure know how to ask a difficult question. :slight_smile:

Maybe someone has other ideas. Stay tuned and stay well.

1 Like