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

Add 3D Line between anchors, and new Text Node for labeling #133

Open Tommy-Elliott opened 2 years ago

Tommy-Elliott commented 2 years ago

We can already use this plugin to place two anchors (and corresponding nodes) on a plane, and to measure the distance between those. That's excellent, by the way.

I would also like the ability to insert a thin Line between two anchors in the 3D scene (a long thin colored cylinder or block, with configurable radius, color, and opacity) and also ideally a new Text Node as a label for that Line, again in the 3D scene. For both the Line Node and the Text Node, I'm sure there would be numerous use cases where AR developers would want to use those individually, including for labeling distance measurements.

My use case is desiring to capture and save both a single distance measurement value and a screenshot of the labeled measurement in the 3D scene, so an app user can answer a measurement question in a way that can be quickly measured and reviewed.

I envision the Line as being a node too, ideally anchored on both its start/end point anchors, but whatever representation is easiest would be fine too.

I envision the Text Node as rendered text on a 2D facet of a translucent thin block (like a thin rectangular chat bubble in 3D) anchored to either an anchor or the midpoint of a Line, where someday the Text Node could also be configured to auto-rotate to remain perpendicular to the camera for readability when desired.

https://github.com/mickod/LineView could maybe be a starting point for an Android Line (or so could the code for displaying the world origin cylindrical axes already existing in the ar_flutter_plugin package).

https://3dviewer.net/#model=https://github.com/google/model-viewer/blob/master/packages/shared-assets/models/odd-shape-labeled.glb shows a model that displays actual text characters as 3d object representations (one possible approach for Text Node).

A textured cube model that can be edited to use a different texture: https://github.com/KhronosGroup/glTF-Sample-Models/tree/master/2.0/BoxTextured

Anyone can edit any glb online using: https://modelviewer.dev/editor/ https://www.creators3d.com/online-viewer

(and convert glb to gltf here if you used modelviewer editor): https://products.aspose.app/3d/conversion/glb-to-gltf

mugiwarajeff commented 1 year ago

Hello Tommy, did you resolve your problem with this library, if yes, how ?

Tommy-Elliott commented 1 year ago

Unfortunately not with this library. I did eventually get the desired effect after a lot more work by integrating a couple Unity scenes into the Flutter app using the flutter_unity package along with a small Unity project, using Unity as a Library (see the flutter_unity package and learn to script and use Unity). That allowed me to run both Flutter and Unity in the same app, and communicate between them and switch between showing them as necessary.

mugiwarajeff commented 1 year ago

Thank you a lot, i'll try this!