CariusLars / ar_flutter_plugin

Flutter Plugin for AR (Augmented Reality) - Supports ARKit on iOS and ARCore on Android devices
MIT License
335 stars 255 forks source link

Fixed rotation of objects on a plane #135

Open IoanEOD opened 2 years ago

IoanEOD commented 2 years ago

Is it possible to place objects on a plane aligned with the plane surface but pointing in one direction, instead of each object being rotated to face toward the camera like in the "objectsonplanesexample.dart" example.

For example in the following picture, could the arrows all be pointing up when placed on the plane, and still be pointing up when getting moved around with the pan handler? Screenshot_20220824-160007

infocodiste commented 2 years ago

@IoanEOD , you just have to add rotate degree value in transform Metrix4 while adding a node in the planet, like below

ARNode object = ARNode(
            type: NodeType.localGLTF2,
            uri: "assets/3d/duck.glb",
            name: map["name"] as String,
            transformation:
                const MatrixConverter().fromJson(map["transformation"])
                  **..rotateY(<degree> * 3.1415927 / 180),**