.lookAt() problems

I was able to successfully get a single Mesh to lookAt() a Vector3 object, but when I try to do this with a Group of Meshes things go kinda crazy!

Here’s what I mean:
When I create a single Cone Mesh (for example) and then use lookAt() to have the Cone rotate in place to follow say my Mouse’s movements, everything works great.

But if I create this Cone Mesh, then create a Box Mesh, and then add both of those Meshes to a new THREE.Group() - and then apply lookAt() to that Group, something very weird happens. Instead of the Group rotating in place to follow my Mouse’s movements (meaning have both the Cone and the Box following my Mouse movements,) the Group’s entire location - meaning it’s X, Y, and Z coordinates, all change continuously so that the Cone and the Box float all over the screen every time I move my Mouse.

So instead of them staying in place and simply rotating to follow my mouse, they’re flying all over the place.

So what am I doing wrong?

OR: is it simply not possible to use lookAt() with a THREE.Group()?

:thinking: Do you have a simple live example of your setup as a sandbox or codepen? This doesn’t sound right… Group() is an extension of Object3D() so should work as expected.

I don’t cause it’s from this whole big project.

Guess I gotta create a new sample project just so I can isolate this particular functionality.

I’ll get on it… stay tuned!

1 Like

Yes best to isolate the issue… Here’s a simple codepen boilerplate you can fork if needed…

1 Like

Most likely your individual meshes origin is not set to their own 3D geometry.

1 Like

Sorry guys - my bad.

I was setting the position of each mesh within the Group independently, when I should have been setting it to the Group’s position and then adding to it it’s own little (x, y, z) delta values, as needed.

Obviously had too much turkey over the holiday… :melting_face: :nerd_face: