Closed Leiong closed 5 years ago
Hi Leiong,
Question 1: I want to scale the content rendered by ARSessionOrigin, arsessionOrigin.transform.localScale = Vector3.one * scaleValue, but it will affect the point cloud particle effects. It looks strange, is it something I missed?
Could you post a screen shot of the "strange" result?
Problem 2: Disable ARsession, then enable ARSession, the previous plane still appears and cannot be cleared. I need to implement enable AR, reset AR, close AR, how do I need to set it up;
Thanks for the code snippet. You should not set ARSubsystemManager.systemState
yourself (the setter should be private -- it's a mistake that it isn't). The correct way to reset the session is to Destroy
it and re-add it, though there are some known issues with this, particularly on ARKit. This will be fixed in the next preview release. I'm also going to add a method Reset
to the ARSession
to make this easier.
Hi Timm, Question 1: When I want to scale the content rendered by ARSessionOrigin, the position of the particle effect is wrong, and the size of the border changes. This is not the result I want. Question 2:After the Cube is generated, is there a way to remove the particle effects and planes? This will not affect my observation of the object. (Sorry, this is the text of Google Translate, I hope you can understand it......)
Question 1: When I want to scale the content rendered by ARSessionOrigin, the position of the particle effect is wrong, and the size of the border changes. This is not the result I want.
Does your point cloud prefab have a non-zero position? It looks like an extra offset is being applied. The line renderer being affected by scale is currently expected. The outline is mostly for debugging purposes. You can simply remove the line renderer from your prefab if you don't want it.
Question 2:After the Cube is generated, is there a way to remove the particle effects and planes? This will not affect my observation of the object.
Yes. To disable plane detection and point cloud updates, you can disable their managers: ARPlaneManager
and ARPointCloudManager
, respectively. To remove existing planes/point cloud from the scene, you can disable or remove their GameObject
s. You can get all the planes with ARPlaneManager.GetAllPlanes
and the point cloud with ARPointCloudManager.pointCloud
I was having a similar issue to this and scaling the point cloud prefab by the same scale as the ARSessionOrigin
resolved the issue for me.
I was having a similar issue to this and scaling the point cloud prefab by the same scale as the ARSessionOrigin resolved the issue for me.
That sounds odd. What does your scene hierarchy look like? Does your point cloud prefab have an identity transform?
Yes. To disable plane detection and point cloud updates, you can disable their managers: ARPlaneManager and ARPointCloudManager, respectively. To remove existing planes/point cloud from the scene, you can disable or remove their GameObjects. You can get all the planes with ARPlaneManager.GetAllPlanes and the point cloud with ARPointCloudManager.pointCloud
After the Cube is generated,remove existing planes/point cloud from the scene
But the planes/point cloud did not appear when ARSession.Reset();
Does your point cloud prefab have a non-zero position? It looks like an extra offset is being applied. The line renderer being affected by scale is currently expected. The outline is mostly for debugging purposes. You can simply remove the line renderer from your prefab if you don't want it.
the point cloud prefab have a non-zero position, but this problem will still appear,Is the method like this?
That sounds odd. What does your scene hierarchy look like? Does your point cloud prefab have an identity transform?
My scene hierarchy looks like this. Aside from a few UI-related addition and a camera clipping plane tweak (to account for the 300 scale), it's identical to the sample.
I use the default point cloud prefab generated from the Right-Click menu entry, and it has a completely zero'd out transform with the exception of scale.
@Leiong Thanks for the screenshots! Very helpful.
But the planes/point cloud did not appear when ARSession.Reset();
Did you also re-enable the point cloud and plane managers? It looks like you disable them, then reset the ARSession
, but don't re-enable them. If those managers are disabled, then plane detection and point cloud updates are disabled.
the point cloud prefab have a non-zero position, but this problem will still appear
The image you posted is of the plane prefab. Can you double check the point cloud prefab?
Is the method like this?
That is the correct way to scale the ARSessionOrigin
, yes.
@southrop Hmm. Could you share your project? Either here or send it to me at timm@unity3d.com
@timm-unity I've sent you an email with a replication
@southrop Thanks; was able to repro, and I know what the issue is. This should solve @Leiong 's problem too.
In your point cloud prefab, change the "Scaling Mode" to "Hierarchy":
This is what I use to test, but for some reason the point cloud created from the XR menu produces one with Scaling Mode set to "Local". I'll fix the generation util to use the correct setting.
@timm-unity Brilliant, that resolves it!
While you're making changes to the generation util, perhaps it's worth mentioning that the default point cloud gameobject gets created with the name AR Default Point Cloud
with a space at the end. Not really a big issue but seems unintentional.
Nice catch; will do!
Hi Unity, Question 1: I want to scale the content rendered by ARSessionOrigin, arsessionOrigin.transform.localScale = Vector3.one * scaleValue, but it will affect the point cloud particle effects. It looks strange, is it something I missed?
Problem 2: Disable ARsession, then enable ARSession, the previous plane still appears and cannot be cleared. I need to implement enable AR, reset AR, close AR, how do I need to set it up; Thanks!