We want to zoom on specific location on avatar based on cursor position.
To achieve this, we created button control once clicked(button) the zoom option should be enabled.
am stuck how to scale only at specific location and return to normal once clicked on same button.
What specific location are these? Would it be just one of the meshes. In case, ez enough, I would simply make the mesh pickable when initiating the zoom action. On hit, record the zoom on status (with a variable) and target the camera to the picked mesh. If the same button is also used for zooming Out (like a toogle), just add if !onzoom in the function and reset camera target and radius to the initial. Is that what you want? Let us know if you need an example or if you are good with just the explanation.
am justing trying to implement yur points. am stuck with zoom out options…
my requirement is, once the zoom icon is clicked the cursor should change to rectangle and mouseover on mesh should enlarge.
and deselect once clicked outside the mesh
Does this mean you want to be able to hold click and draw an area for the zoom?
To be honest I have no faen clue how to do that.
I can help with the behavior of picking a mesh and zooming in on it. And then with zooming out when selecting the background/root or when clicking again on the zoom button. But if you want to create a select area and zoom on it, this is beyond my expertise. Can you confirm please (if so I’ll call in the one person who would likely know)
I did some progress on this. I am stuck at this point with I guess the same issue that occured when setting a decal on the shirt (I believe this was your project, wasn’t it?). All meshes are at zero position, so targeting the mesh does not work. You should go back to how you fixed your decals or ask the person who helped you with this part. Sry I don’t have more time right now.
In this PG below, I already fixed the way you pick your mesh and implemented the base of a logic for zooming in or out by clicking the button. Hope this helps already a little…
You could use the world center of the mesh’s bounding box to target the center of the mesh. Building on @mawa’s last PG, I made that change and then used CreateAndStartAnimation to animate the target and radius for a simple example. Also this doc has LOTS more info on animating (I just did it the easy/quick way).
I guess I can answer this part. The answer is of course yes and I actually would propose to do it not by moving the camera or changing the camera radius, but simply by changing the fov. Thus, you can make sure the camera will never go through the mesh. I believe it would be easier to handle this way. It also give a nice ‘zoom on’ effect.
Here’s a very rushed and simplistic extension of the PG showing this fov effect when you click on the head.
Ooh I like the idea of using FOV to zoom without going through the mesh like that.
And OTOH if you want to zoom onto the clicked point on the mesh instead of the center of the mesh you can target the pickedPoint instead of the center of the bounding box like below. Not sure which you were asking about but now you can see how to do both.
Edit: I tried animating fov instead of radius and also added a predicate that applies the mesh’s skeleton to its bounding info before picking so that you can click on the swinging arms and legs easier and that seems to work nice.
EDIT2: OK after playing with it a little more, there’s things I like better about the different versions, maybe some combination of animating radius and fov could work great? Well now you have some more ideas and examples to play with.