OrbitControls keyboard controls: rotate target instead of rotating around target

I don’t like how the keyboard controls in OrbitControls work, so I disabled them altogether and wrote my own using my own listeners and functions. I got everything to work except the up/down rotation. Instead of rotating the camera around the target, I would like for the camera to stay still and the target to rotate around it, like in an FPS (so for example you press the up arrow and the target rotates up by 5 degrees).

I honestly don’t even have a piece of code to show because I have no idea where to start. I tried using applyAxisAngle on the target but it doesn’t work, I tried messing with quaternions and euler but I kind of failed math in highschool a lot. Any help or direction would be greatly appreciated

OrbitControls does not rotate around the target with keys. :thinking:

OrbitControls camera will always look at the target - even if you change it in someway, it will reset on the next controls.update() call. One way you can work around this is to create a mock target (invisible 3d object on the scene) that will be the actual controls.target, and move it around to simulate the behaviour you describe (so it either copies the position of the visible target object, or moves “up by 5 degrees” etc.).

Huh, my bad, it actually doesn’t. I could’ve sworn it did, I guess that’s why I started messing with it weeks ago, there isn’t even a keyboard control to rotate. The “rotate around target” behaviour comes from this rotateUp method that I exposed:

this.rotateUp = function(degrees) {
	rotateUp(degrees);
	this.update();
}

Is there no way to just rotate the target’s position (or calculate a new rotated position and move it) and be done with it? It’s the only keyboard control left, lol.
I did the left/right rotations by imagining the target as a point on a circumference with center on the camera position, then I calculate another point 2 degrees left/right on the same circumference and move the target. Basically, looking at it from the top:
rotation
(Brown is the camera position, green is initial target, orange is new target)
But I can’t figure out how to do something similar with up/down, because the target would need to be moving on a sphere