StephenGuanqi/Unity-ARKit-Plugin

feature request: Move multiple elements independently

aaHoek opened this issue · 1 comments

I'd love a feature to create multiple objects and be able to move them independently of each other.

example:
I have two UI buttons, one for a cube and one for a sphere.
I can click the cube button and create a cube at the position of the plane I touched. I can then touch another position to move the cube to this new position.
I can then do the same for the sphere after clicking it's corresponding button.

Would something like that be possible?

Hi,

From my perspective, what you said is totally possible.

Just create a game object in your C# scripts when you have tapped the corresponding button, and change its transform in the unity world coordinates when you touched the screen using the hitTest api.

And regarding your situation description, I guessed your confusion is how to move the cube/sphere when you tap the screen only for the previous manipulated one. For the manipulation, it could be either create a cube/sphere object or move a cube/sphere.

Just use a stack to store those game objects each time you tap the create button to create an object. Then everytime you perform hitTest action and get the new coordinates to move the object, just move the top game object in the stack using the new coordinates.

You can dig into the sample code provided by the zombiewalk unity project. That should be helpful.