Switch camera to zoom on mesh

Goot to see you, too, Naz. Take good care of yourself and each other, and the same goes for everyone.

IIyes - here is another camera-animating monster. https://www.babylonjs-playground.com/#3U658N#38

Note: Version #37 and #39 might work better. I tried a DIFFERENT way of calling forceRebuild() in version #38, and it MIGHT have problems. Version #39 reverts back to version #37 method of calling forceRebuild().

Lines 157-177 are some “when animations finished” functions… things that might be handy for you, someday.

The camera and cameraTarget animators/positioners… start at line 180. There are two primary animation functions… a camera TARGET animator at line 180, and a camera position animator at line 191.

The 7 “dynamic HTML” buttons… when clicked… activate 7 click-handler functions… in lines 200-231. These allow precise camera and camera target positioning… based-upon button clicks instead of shirt clicks. I think this could be useful for you, because… you might do adjusting on many parts of the shirt.

These are HTML buttons… and some projects won’t like HTML buttons. BabylonJS has ANOTHER type of buttons available… using “GUI 2d” (and GUI 3d) systems. Use the Babylon GUI - Babylon.js Documentation

Personally-speaking, I think it would be wise to change these HTML buttons… into being GUI 2d buttons. When myself and a friend built this playground, my friend wanted to use HTML buttons, so we did so. :slight_smile:

As you can see, moving the camera around-upon the model… is challenging. IF/AFTER you get a good “centered root” mesh/node (a master PARENT of all other mesh of the model)… you might later learn that it is easier to move the mesh (root) instead of the camera. You could move/animate the “root” (master parent) until the collar is in front-of camera lens. Then move/animate shirt root until cuff is in front of lens, etc.

Everything is possible. To “inspect” the mesh/lights/cam “nodes” of a BabylonJS scene, you can use the “Inspector” feature, available by clicking the gear-shaped icon at top of playground, or available as an extension for home projects. The Inspector is a wonderful tool, and it allowed me to find the names of all your collar mesh… yesterday.

NOW you have plenty of things to study and play-with… should keep you busy for some time. Good luck… you’re on a high-speed train to success, now. :slight_smile:

Here’s another forum thread… where we clicked upon various parts of a helicopter model… and moved the camera around. https://forum.babylonjs.com/t/actionmanager-with-assetmanager-and-camera-pivot-points For one of the demos, we put an actionManager on every piece of the model… 74 pieces… 74 actionManagers… if I rem right. Gruesome.

4 Likes