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

Issue with Implementing Trackball Movement and transformToUnitCube in Google Filament Library #8328

Open
RajatDBazaar opened this issue Dec 24, 2024 · 0 comments

Comments

@RajatDBazaar
Copy link

We are using the Google Filament library to render 3D models in our Flutter app. By default, the library supports turntable movement for interacting with the model, but we require trackball movement for more flexible interactions.

To achieve this, we implemented custom user interaction logic for rotation and zooming. While this works well for most use cases, we are encountering an issue with the transformToUnitCube() function when using our custom interaction method:

When the model is initially rendered, it fits perfectly into the unit cube as expected.
However, as soon as we interact with the model for the first time, it zooms out significantly.
After this initial zoom-out, subsequent interactions work fine, and the model maintains its position and scale.
Our current approach involves applying transformations (rotation and scaling) manually using a custom method. However, the problem seems to arise from a misalignment between our custom transformation logic and the transformToUnitCube() function.

Here’s a summary of our setup:

Custom interaction logic: Handles gestures for rotation (trackball movement) and zooming (pinch-to-zoom).
Model transformation: Combines scaling and rotation into a transformation matrix applied to the model.
Issue: The first interaction causes the model to lose the scaling from transformToUnitCube, but subsequent interactions work as expected.
We would appreciate guidance on the following:

How can we ensure that the model consistently retains the transformation applied by transformToUnitCube even with custom user interactions?
Are there best practices for implementing trackball-like movement in the Google Filament library?

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

1 participant