Rotate objects in relation to your camera movement to make

Hi guys, I want to make a floating label in my scene, which has a line and text. I then want that line and text to rotate as I move the camera to essentially make it look like the label is always facing towards me, I use orbital camera which focuses on the middle of the room, and the label is near the edge if that helps

what sort of commands would i do to get to that?

to simply rotate the label to face the camera you can use label.lookAt(camera.position) or label.rotation.copy(camera.rotation) in an animation loop

1 Like

do you know if there’s ways to “dampen it” so to speak, so for example, could I do camera.position/2 to make it not follow so hard and it stays a bit more restricted in its original position. And also is there a way to make it move with a slight delay, not so locked on to the camera the whole time?

yes, in your animation loop you can do label.quaternion.slerp(camera.quaternion, 0.08) change the 0.08 value as required.
EDIT: i’m not sure if it’s two questions or the same question restructured, can you share a video or live example of what you mean exactly if this ^^ doesn’t answer your question

1 Like

They’re 2 different questions, I don’t have an example on hand but I’ll try to rephrase.

first one:
restrict its movement, so every 2 steps the camera takes, the object only makes 1 step. so it sort of follows the camera but not fully.

second one: is more of a time delay issue. So rather than it following on every move in real time, there’s a slight delay that it starts moving after you have.

can you make a quick and simple minified environment on codepen / jsFiddle that exhibits the functionality so far, its difficult to understand what you mean and this way we can try to implement or point you in the direction of the desired behaviour…

1 Like

Hi I’m sorry this code works on my build, I tried to get it to work on jsfiddle but it doesn’t work for some reason, maybe you can copy that code into your own IDE, I’m using version 0.144.0 plane that will face camera - JSFiddle - Code Playground

so what I want is that plane to rotate to always be facing the camera;

but to try and illustrate my point about delay, if you see in this video (near the end) he has an object that is always following the mouse but there’s a delay, it takes some time for it to reach the new mouse position. Smooth Mouse Follow in Unity | 2D Game Dev Tutorial - YouTube

I would like to replicate that but instead it’s with the rotation of the object that is looking at the camera, there is delay before the object is looking at the camera.

i’ve update your fiddle with the correct import settings and tried to implement what i think you mean…

1 Like


and do you know if it’s possible for it to follow the camera movement just on the y axis?

What do you mean? To nullify the rotation on x axis or translate the plane to match the camera on y position?

1 Like

to translate the plane to match the camera on the y position but not the x

i’ve updated the fiddle but it won’t be as you expect with the use of orbit controls as the camera position y is based on a spherical co-ordinate meaning the higher on y it goes the closer on z it gets, as well as the plane going outside of the camera frustum see the (crude) illustration vvv

1 Like