sceneview-android icon indicating copy to clipboard operation
sceneview-android copied to clipboard

How to add dot and make line between two dot in android sceneview

Open thanhphong190 opened this issue 3 years ago • 7 comments

hi everyone, how to i can add dot when tap model and make line between two dot using library link image: https://drive.google.com/file/d/1EefYfMxao-3UqBE1gwILQjq2uAi_SNuR/view?usp=sharing

thanhphong190 avatar Sep 06 '22 03:09 thanhphong190

Hi! The simplest way to display dots and lines is to use spheres and cylinders with unlit materials. You can create them as glTF models and scale appropriately.

grassydragon avatar Sep 09 '22 07:09 grassydragon

hi @grassydragon , i have create renderable, but how to it in library, code: val color = com.google.ar.sceneform.rendering.Color(.8f, 0f, 0f) MaterialFactory.makeOpaqueWithColor(activity, color) .thenAccept { material-> // The sphere is in local coordinate space, so make the center 0,0,0 val sphere = ShapeFactory.makeSphere(0.02f, Vector3.zero(), material) // How to render sphere??? }

thanhphong190 avatar Sep 11 '22 03:09 thanhphong190

Hi! A similar question has been asked on our Discord server and we've found out that the latest version of SceneView doesn't allow rendering shapes without creating a custom node or using a glTF model.

grassydragon avatar Sep 13 '22 20:09 grassydragon

Hi! A similar question has been asked on our Discord server and we've found out that the latest version of SceneView doesn't allow rendering shapes without creating a custom node or using a glTF model.

hi @grassydragon @ThomasGorisse when i tap model, have add dot and line between two dots but the position of measurement points and lines cannot stick to the model. Can u help me resolve it? (i have research but not have way) link video: https://drive.google.com/file/d/1KOuO52MDQY6mVZKl1kn0R3DuRbWWh4Oi/view?usp=sharing

thanhphong190 avatar Sep 14 '22 09:09 thanhphong190

Hi.

Does your model contains sub objects/meshes or is it a single object one? (You can check it within blender)

The SceneView.pickNode function will give you a Renderable that correspond to the picked subpart of your model at export time.

What you actually want to do will be very easy to handle in SceneView 1.0.0 since the ModelNode will directly have child nodes coming from the glTF objects (Renderables, Lights and even Cameras). So you will just have make each child Node of your ModelNode clickable and add an onTap listener to it.

ThomasGorisse avatar Sep 14 '22 10:09 ThomasGorisse

Hi.

Does your model contains sub objects/meshes or is it a single object one? (You can check it within blender)

The SceneView.pickNode function will give you a Renderable that correspond to the picked subpart of your model at export time.

What you actually want to do will be very easy to handle in SceneView 1.0.0 since the ModelNode will directly have child nodes coming from the glTF objects (Renderables, Lights and even Cameras). So you will just have make each child Node of your ModelNode clickable and add an onTap listener to it.

hi @ThomasGorisse @grassydragon can you for me example onTap in ModelNode and get point at position tap?(gen rendering shape and show it). Please!

thanhphong190 avatar Sep 17 '22 03:09 thanhphong190

hi @ThomasGorisse @grassydragon can you for me example onTap in ModelNode and get point at position tap?(gen rendering shape and show it). Please!

Hi! Yes, as Thomas said you can find the tapped renderable and modify its material, for example. However, to find the point in the 3D scene where the model was tapped you will need to do additional calculations (to unproject the screen point).

grassydragon avatar Sep 17 '22 05:09 grassydragon

Hi.

Does your model contains sub objects/meshes or is it a single object one? (You can check it within blender)

The SceneView.pickNode function will give you a Renderable that correspond to the picked subpart of your model at export time.

What you actually want to do will be very easy to handle in SceneView 1.0.0 since the ModelNode will directly have child nodes coming from the glTF objects (Renderables, Lights and even Cameras). So you will just have make each child Node of your ModelNode clickable and add an onTap listener to it.

Hi, Can you also retreive child nodes from GLB files in SceneView 1.0.0 ? I want to change the node material color onTap.

pfontainesur avatar Oct 18 '22 08:10 pfontainesur

Hi. Have a look at https://youtu.be/00vj8AttWO4 Your GLB nodes will be retrieved as children of the ModelNode. You can them retrieve the one you need by id, name,...

ThomasGorisse avatar Oct 18 '22 08:10 ThomasGorisse

You can also, just add an onTap listener to your ModelNode children (only renderable can be touch detected)

ThomasGorisse avatar Oct 18 '22 08:10 ThomasGorisse

hi @ThomasGorisse @grassydragon , version 1.0.0, can i set position for view node? I don't see any function or param to set

thanhphong190 avatar Oct 25 '22 04:10 thanhphong190

hi @ThomasGorisse @grassydragon , version 1.0.0, can i set position for view node? I don't see any function or param to set

Hi! It should be possible to position a ViewNode since it implements the TransformComponent interface.

grassydragon avatar Oct 25 '22 08:10 grassydragon

hi @ThomasGorisse @grassydragon , version 1.0.0, can i set position for view node? I don't see any function or param to set

Hi! It should be possible to position a ViewNode since it implements the TransformComponent interface.

Screen Shot 2022-10-28 at 17 05 37

hi @ThomasGorisse @grassydragon when I using ViewNode -> issues as photo! how I resolve it?

thanhphong190 avatar Oct 28 '22 10:10 thanhphong190

Hi, Thanks for the feedback.

Can you share the part of code you are using for the ViewNode (with its layout please) so we can have a look at where the issue is coming from.

ThomasGorisse avatar Oct 28 '22 10:10 ThomasGorisse

Hi, Thanks for the feedback.

Can you share the part of code you are using for the ViewNode (with its layout please) so we can have a look at where the issue is coming from.

hi @ThomasGorisse @grassydragon layout item_dot.xml

<?xml version="1.0" encoding="utf-8"?> <TextView xmlns:android="http://schemas.android.com/apk/res/android" android:id="@+id/dots" android:layout_width="8dp" android:layout_height="8dp" android:layout_weight="1" android:background="@drawable/ic_red_dot" android:textColor="#ffffff" android:gravity="center" android:orientation="vertical" android:paddingStart="18dp" android:paddingEnd="18dp" android:paddingTop="12dp" android:paddingBottom="12dp" android:textSize="30dp" android:textStyle="bold" android:text="" android:textAlignment="center" />

drawble ic_red_dot.xml

<shape xmlns:android="http://schemas.android.com/apk/res/android" android:shape="oval"> <solid android:color="#DB0808"/> </shape>

create viewnode: val view = ViewNode(sceneView, R.layout.item_dot, true, true) sceneView.addChildNode(view)

thanhphong190 avatar Oct 31 '22 02:10 thanhphong190

Hi, Thanks for the feedback.

Can you share the part of code you are using for the ViewNode (with its layout please) so we can have a look at where the issue is coming from.

hi @ThomasGorisse , can you help me resolve it, please

thanhphong190 avatar Nov 03 '22 03:11 thanhphong190

Hi, Thanks for the feedback. Can you share the part of code you are using for the ViewNode (with its layout please) so we can have a look at where the issue is coming from.

hi @ThomasGorisse , can you help me resolve it, please

There is bug in ViewStream Builder image

ozh-dev avatar Dec 16 '22 11:12 ozh-dev

Nice catch @ozh-dev ! I added you the contributor role. You should be able to push directly to the repository. Would you mind creating a PR with your fix? Thanks

ThomasGorisse avatar Dec 17 '22 15:12 ThomasGorisse

Nice catch @ozh-dev ! I added you the contributor role. You should be able to push directly to the repository. Would you mind creating a PR with your fix? Thanks

No problem. I'll do it.

ozh-dev avatar Dec 18 '22 11:12 ozh-dev

Hey there, it looks like there has been no activity on this issue recently. Has the issue been fixed, or does it still require the community's attention? This issue may be closed if no further activity occurs. Thank you for your contributions.

github-actions[bot] avatar Mar 19 '23 05:03 github-actions[bot]

Closing this issue after a prolonged period of inactivity. If this issue is still present in the latest release, please feel free to create a new issue with up-to-date information.

github-actions[bot] avatar Mar 27 '23 05:03 github-actions[bot]