"Tidal lock" of plane using orbit controls

Hi I’m new to the software and I’m having some trouble.

I am using orbit controls and I would like to make it so a plane centered at (0,0,0) will always stay parallel to the camera’s plane. This plane never moves, I just want to move the camera using orbit controls and have the plane stay flat on the screen. Most solutions in the documentation I’ve found suggest just disabling the rotation, but I want to remain able to rotate the camera with my mouse but make the plane rotate the same.

I tried setting the normal in my vertex shader to be the cameraPosition, but it throws an error that says I can’t assign values to imports such as normal. I’m not even sure if this would have the effect I want.

I’ve also tried using the .rotation functions in my animation loop to try and counteract the rotation that the orbit controls apply to the plane, but I couldn’t get it to work because the counteracting rotations would just keep going instead of stopping when I stop using the mouse. I think this method would also break down when the plane is not in the direct center of the screen.

The project I’m working on is making a sphere out of 2D. Kinda simple but I’m learning. I made a plane geometry with a shader material. In my vertex I have the standard equation for gl_Position, in my fragment I defined a vec3 that is my light source and then I do a bunch of math with that light source vec3 to get a shadowing effect on my “sphere”. In order to complete the sphere feel I want to be able to change the camera position and see the shadowing effect change in real time. But in order to do this I have to have the plane remain parallel to the camera, since I gotta keep up the illusion of the sphere. Hopefully that explanation makes sense.

Any ideas or solutions are appreciated! There’s probably something I am missing to do this easily lol :slight_smile:

One option is to turn the plane towards the camera in the animation loop:

plane.lookAt( camera.position );

Another option is to add the plane to the camera, and add the camera to the scene. This is done once. However, the plane coordinates should be in the camera’s local coordinate system; also you might need to update the z position if the camera zooms/unzooms:

scene.add( camera );
camera.add( plane );
plane.position.set(0,0,-10); // 10 units ahead of the camera

Thank you, the lookAt function is what I needed. I found that it made my plane move off of the (0,0,0), but in my animation loop I made it so I run the lookAt function and set the xyz position back to (0,0,0) and it seems to work. Unfortunately it does not have the effect I wanted but it’s close.

I think the current issue is my light’s intensity, I have to have my virtual light source at (0,0,1) to have any significant result in shadowing, so I will try to fix that.

Thank you!