# Animation nodes - How to make an object face camera yet let the object rotate around its normal?

Imagine an object, for example a Cube.

Now Imagine the Camera.

Imagine that, whatever the position of the camera is, you always want (a certain face of) the Cube to face the camera.

This means that the normal of the Cube's pointing-towards-the-camera-face will change.

Now at the same time I would like the Cube to rotate around its (Z-)normal ... such that it is spinning around at a constant speed (the input can be the animation's timeframe).

I have been trying for days but I can't make it work.

Also note that non-animation-nodes dynamic ways to let an object face the camera (e.g. Object constraint and Track to) do not seem to make it easy to let the object, at the same time spin around itself ...

# MWE

Use a combination of parenting and constraints. An empty with a trackto constraint can point to the camera, a cube that is a child of the empty will follow the location and rotation of the empty but as a child, it can also have its own rotation animation.

• Starting with a cube, that has an identifiable face, set it up to rotate on its z-axis

• Add an empty and position it on the face, in this example I used a cone to visualise the direction.

• Now when you move the empty, the cube follows and continues to rotate.

• Add a trackto constraint to the empty. Set this to track the camera. Now as you move the empty, the cube follows and the specific face is always facing the camera.

Now the camera can move anywhere, the cube will keep rotating and its face will always be facing the camera.

If you also want the camera to track the cube, you will need two empties, the other to be the parent of the camera, with both children having trackto constraints to follow the opposite empty. This is how a piston can be setup.

• You wrote "Now when you move the empty, the cube follows and continues to rotate." How is this so? As from your explanation, they are two different objects. Commented Jan 9, 2020 at 7:02
• @VincentMiaEdieVerheyen While at worlds origin the cube rotates. As the cube is a child of the empty, it follows the empty's movements. After the parents movement and rotation is followed the childs animation allows it to rotate as if the parents current position is the world origin. Commented Jan 9, 2020 at 9:22

Parent the camera to the object, in this case, the cube.

Simple as that.

• This is interesting. In your GIF, are you rotating the cube? What I need is, while the cube is spinning around its Z axis, the camera can certainly not rotate around the scene like that. There are many other objects and lights and so on in the scene. Commented Jan 7, 2020 at 22:05
• I am rotating the cube, and the camera is following the cube's motion as a result of the parenting. Commented Jan 7, 2020 at 22:06
• Please note in my original question that I want the Cube's orientation (even though it has to spin around its axis) to be camera-dependent, not the other way around. I don't want the position of the camera to be automatically adjusted to the rotation of the cube. Commented Jan 8, 2020 at 7:08