Hi!
I’m looking for some base, library or script than have the camera behaviour as in these examples:
I can’t find the way to replicate that behavior. The camera movement is very smooth and never has a jump, very clean, soft.
Any suggestions?
Help please!
The controls remind me at the following official three.js
example: three.js webgl - materials - normal map [Lee Perry-Smith]
I guess you can use the demo as a foundation for your own code.
2 Likes
drcmda
3
this is quite easy to do: Baked AO - CodeSandbox
the code:
obj.rotation.y = THREE.MathUtils.lerp(obj.rotation.y, (mouse.x * Math.PI) / 10, 0.1)
obj.rotation.x = THREE.MathUtils.lerp(obj.rotation.x, (mouse.y * Math.PI) / 10, 0.1)
4 Likes
Both solutions are great, this second one is more simple and easy to control. Just one thing.
You can use ( mouse.x - (window.innerWidth / 2) )
instead of mouse.x
to use de center of the screen to control the rotation.
Thanks!
1 Like
drcmda
5
right, forgot to mention that. the mouse object in that code is already centred, good point!
Zebrap
6
Change pivot or rotation camera makes this solution look bad.
Anyone have an idea what to do in this case?