How to rotate an object towards another object?

I’m stuck on trying to have object A always being rotated towards object B. I’ve found Make Quaternion From Vectors node, but I’m not able to rotate object along this quaternion. How to make it work?

I’m attaching simple composition with two objects.

![rotate towards][rotate towards]
[rotate towards]: https://vuo.org/sites/default/files/question/Screen%20Shot%202017-04-08%20at%2014.19.43.png

RotateTowards.vuo (5.19 KB)

—  

Try this:

A couple of differences from your composition…

  • Your composition has Make Quaternion from Vectors -> Convert 4D Point to 3D Point -> Make 3D Transform. Instead of Convert 4D Point to 3D Point, which discards the W value of the point, you should use Make Quaternion Transform.
  • For Make Quaternion from Vectors, the inputs should be two vectors (directions) in 3D space, and the output is a quaternion representing the rotation from the first vector to the second vector. For this composition, the From Vector should be the direction the cube is initially “pointing”. Since its long end is along the x-axis, we’ll say it’s pointing along that axis: (1,0,0). The To Vector should be the direction you want the cube to point. Since it should point at the cone, the vector to pass in is the difference between the cube’s position and the cone’s position.

RotateTowards.vuo (5.21 KB)