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