Camera follow TransformNode

I want to set the position and direction of a camera to the position and direction of a transform node. Intended behaviour is that the camera will always be at the exact position and direction of the node when rendering:

init: = new Camera("Camera", new Vector3(0, 0, 0), this.scene);

loop: = node.position;
    // = node.direction; 

I tried it with the position so far, but the view doesn’t change. I read that the usage of Camera is discouraged, but I don’t need all the behaviour of the other cameras.

A playground would help us to help you.

Also a TransformNode does not have a direction property, it does have a getDirection method.
TransformNode - Babylon.js Documentation

1 Like

That’s basically the setup. One Camera, one TransformNode. Set camera position to node position. After that, render the scene. The canvas doesn’t show the camera at the expected position, but at the origin.

Well, appears that Camera doesn’t work. I resorted to UniversalCamera and using the following code:

1 Like