Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Sequentially evaluating and replacing drivers #19

Open
MarijnS95 opened this issue Aug 2, 2023 · 2 comments
Open

Sequentially evaluating and replacing drivers #19

MarijnS95 opened this issue Aug 2, 2023 · 2 comments

Comments

@MarijnS95
Copy link
Contributor

Hey! We're using dolly and wanting to swap out camera drivers at runtime (specifically Rotation and YawPitch). There are no helpers to expose this in the public API, but since the drivers Vec is (perhaps unintentionally) pub we can patch those in. Is that an intended use-case?

As an alternative approach we also looked into having both drivers on the stack so that we could set one of the two to IDENTITY, but as it turns out dolly doesn't really stack the drivers sequentially, instead the Position/Rotation/YawPitch (and maybe all the other) drivers replace a translation or rotation on update(), meaning only the last rotation or position sticks. This is also visible in the README example, where a camera has a Rotation (that is updated) but useless because the subsequent LookAt overwrites the rotation.

@MarijnS95
Copy link
Contributor Author

Something I just had in mind (for my specific use-case) is a function that takes a generic A and B: it tries to find A in the driver stack and if it finds it, it replaces it with a (default initialized or passed?) instance of B and returns a (mutable) reference. If it finds B instead, it immediately returns a reference to it.

Though that seems weirdly add-hoc and ugly, and it is perhaps cleaner to just have my A/B on the stack sequentially, while the rotations are multiplied in update(), so that I can zero out one or the other.

@h3r2tic
Copy link
Owner

h3r2tic commented Sep 11, 2023

Swapping of drivers at runtime is not something I've given any thought. When changing cameras in my apps, I'm just replacing the entire rig, and so far that has worked fine. That might not be sufficient for your use case, but in practical terms I won't have the resources to look into this myself 👀 😅

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

2 participants