I have looked through the other questions regarding model to follow mouse but none talks about isolating the head of a 3d object to follow mouse with a stationary body. For instance, with a hydra, only setting it such that the many heads follow the mouse with a stationary body, is this possible with 3JS?
Yes but it is important that your model fulfills some prerequisites e.g. the head should be a separate 3D object and a child element of the body. If so, you can select the head with a query (e.g. via getObjectByName()) and transform it without affecting other parts of the model.
1 Like
awesome, I’ll try it out
Here is an example.
- It loads a glTF and an animation.
- It finds and creates a reference to the head bone.
- It removes any animation tracks that modify that head bones quaternion, otherwise the mixer will override any changes I make with the mouse.
- head bone is then managed by mouse movement.
Head follow mouse : SBCODE Editor
2 Likes
it would look pretty weird/unnatural if only the head follows but it would be not so hard to accomplish natural movement. take a look
there is a codrops article explaining it with vanilla code How to Create an Interactive 3D Character with Three.js | Codrops
2 Likes