Plonq / bevy_panorbit_camera

A simple pan and orbit camera for the Bevy game engine

Geek Repo:Geek Repo

Github PK Tool:Github PK Tool

Feature request: changing the UP vector of the camera

yasammez opened this issue · comments

It would be cool if I could change the camera's UP vector, for instance by holding ALT and using the scroll wheel, or whatever input scheme would be considered good.

That way I could not only yaw and pitch, but also roll (I am slowly getting a sore neck from trying to find a nice shot in my pet project 😇)

grafik

Hey, thanks for the request!

As soon as you add the third axis of control with this setup (camera orbiting the object), things get kinda wonky and unintuitive. E.g. does rolling change the other axes, what happens if you roll 180 degrees, etc. I have a feeling it wouldn't be very good, but I'll try it out - maybe there's a way to do it that works. Or maybe I could expose the camera's UP so one could control it however they liked, we'll see.

Perhaps for something like this, rotating the model itself is better than moving the camera.

So I tried this out quickly, and I don't think there's a way to make this work well. There are two options I can see - apply roll before or after the axes. If applied before, then after rolling, orbiting left/right is still horizontal as you'd expect, but the roll axis changes depending on what your orbit location is (alpha). If applied after, then the roll axis always stays the same (around the forward vector of the camera), but then the alpha orbit axis is no longer relative to the camera.

If this plugin worked be simply modifying the existing transform of the camera, then it could work, but alas it does not. I'm open to solutions.

These two videos show the two problems:

Screen.Recording.2024-01-21.at.8.55.04.pm.mov
Screen.Recording.2024-01-21.at.8.55.52.pm.mov

Thanks for the quick reply! I will think about this and see if I can come up with something.

I jumped to conclusions too quickly. I may have a solution. Stay tuned :D

Screen.Recording.2024-02-10.at.11.43.28.am.mov

Hey, let me know what you think of the roll feature. Are the controls okay? Interested to hear your feedback.

Check out advanced and alternate_up_vector examples.

Also interested in your thoughts about this issue: #48