Does anyone know why normal rotation of assets is not working after panning the assets.
I have created a panning of assets control based on shift+click but after panning the assets, the normal rotation is not working rather the assets take a circular motion when I tried to rotate. The circular rotation becomes bigger when the assets are panned to larger distance.
Yeah tried some of the things like camera.setTarget ,
Camer.postion, and mesh position kind of things but it seems like it’s not working.
Is there any property or method which will rotate only the assets not the camera around the scene?
If you want to rotate the assets independently from the camera, you’ll need to rotate the assets themselves. There isn’t any built in controls to do this with the mouse.
I am not getting it.
Is there anyway to set the camera linked with asset position.
Like the camera target position should be assets position even if it is moved from center of screen.
@carolhmj
The document was helpful to improve my knowledge on the camera settings but still I couldn’t figure out how to get a normal rotation after panning. Instead of rotating all around the center of origin.
As per my previous explanation, when you pan the camera, you’re changing its target. If you want the rotation to be relative to the sphere’s position, before you rotate the camera, you have to set the target to be the sphere. Another possibility is overriding the default panning behavior to change the targetScreenOffset property, which offsets the target without changing it, so that the target doesn’t change for the rotation: Change TargetScreenOffset | Babylon.js Playground (babylonjs.com) (you can check this behavior in this demo using the ijkl keys to pan the camera).
Yes, same as @carolhmj I am also not sure to understand just precisely what you want to achieve. Using an arcRotateCamera, the camera orbits around a target. If you offset/pan from the target, you are orbiting around your new location. So it is not the target that is moving in circles as you said. It’s the camera rotating around a point that after panning is now offset of your mesh.
Here’s an example where on mouse release, the camera targets again to your mesh. However, I don’t know what this is good for? One thing I can think of would be that on a given action (mesh pick or trigger or key binding), the camera would move/animate from the panned position to center on the target again. This is something I did in one my projects. But simply doing it straight from a pointerUp doesn’t feel like very natural to me. At least, it hopefully gives you some explanation about it.