olexale / arkit_flutter_plugin

ARKit Flutter Plugin
MIT License
796 stars 225 forks source link

zoom and rotate bug #146

Open maxTeste opened 3 years ago

maxTeste commented 3 years ago

hi, the zoom and rotate features work, but there's a bug. each time you zoom or rotate the object it resets to the default position. is there any way to improve these two features and not always reset to size and starting position?

NicolasDurant commented 3 years ago

For me the scale and rotation work independently, but after applying a rotation the scale then will scale into ridiculous high values and eventually crash the app. This also happens with the Manipulation example provided. Do you encounter the same issue with your object @maxTeste? And if not, might you share how you rotate and scale the object?

I see that the scale setter on an ARKitNode somehow takes the rotation into account, I am sadly no expert on these things and I am wondering, if that is causing my issue of the scaling suddenly getting extrem values when combined with rotation.

set scale(Vector3 value) { transform = Matrix4.compose(position, Quaternion.fromRotation(rotation), value); }

frarcos commented 2 years ago

There is an hacky workaround for this bug. Bypass the broken scale and rotate functions of the plugin by removing the object from the SceneView and placing a complete new one (with new sizes and rotation) at every gesture handler call. It is definitely not ideal, but for lightweight renders it's unnoticeable for the user and easy to implement.