CariusLars / ar_flutter_plugin

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

how to resize objects #205

Open abdelrahman-abied opened 1 year ago

hamadar commented 1 year ago

did you find any solution ?

everoo commented 1 year ago

ARNodes have a scale variable aka: ARNode pointNode = ARNode( type: NodeType.fileSystemAppFolderGLTF2, uri: "point.gltf", scale: Vector3(0.1, 0.1, 1.1), ); This would scale the "point.gltf" file to 10% of the original size in the x, and y directions. And the z direction would be 10% bigger.

abdelrahman-abied commented 1 year ago

ARNodes have a scale variable aka: ARNode pointNode = ARNode( type: NodeType.fileSystemAppFolderGLTF2, uri: "point.gltf", scale: Vector3(0.1, 0.1, 1.1), ); This would scale the "point.gltf" file to 10% of the original size in the x, and y directions. And the z direction would be 10% bigger.

i am tried to do that but it's not resize creaded node

everoo commented 1 year ago

Ah, if you try to update the size of an existing node nothing will happen, what I do is: remove the node from the object manager, adjust the size of the node, Then add the node back to the object manager. Hopefully that works for you but it would be nice if changing the size of a node updated automatically.

abdelrahman-abied commented 1 year ago

remove the node from the object manager,

please add code sample for this and is the node will be in the same position

everoo commented 1 year ago

Found a much better way to just directly change the scale, or any other value, without having to remove the node. You simply need to set the nodes transform. to set up the node: ARNode node = ARNode(type: NodeType.fileSystemAppFolderGLTF2, uri: "point.gltf"); to set the scale to 10% of its original size: node.transform = Matrix4.identity()..scale(Vector3(0.1, 0.1, 0.1)); to change the scale to 10% of its current size: node.transform = Matrix4.identity()..scale(node.scale*0.1);

abdelrahman-abied commented 11 months ago

thanks for your answer but after resize node every time node back to the first position in the scene

farhodyusupov commented 10 months ago

Hi, @abdelrahman-abied. Could you find any solution? If yes, please can you share it here.

Thanks in advance.