Hi,
I trying implement pick up / put down translation on Y axis in example hellosceneform. Now I set setWorldPosition with modified Y-axis value when model is anchored, this picks up model.
How to make this translation based on gesture, like translation on Z or X axis. It is possible with TransformableNode / TranslationController ?
Vector3 cameraPos = this.sceneformFragment.getArSceneView().getScene().getCamera().getWorldPosition();
Vector3 cameraForward = this.sceneformFragment.getArSceneView().getScene().getCamera().getForward();
Vector3 cameraPosUp = new Vector3(cameraPos.x,0.35f,cameraPos.z);
Vector3 finalPosition = Vector3.add(cameraPosUp, cameraForward.scaled(1.0f));
transformableNode.setWorldPosition(finalPosition);
Thanks
If I understand the question correctly you are trying to add a completely new gesture that works with the existing ones, but moves an object up/down instead of on the xz plane?
If so I'll look into this.
@malik-at-work Yes, you understand the question correctly.
I've created a working example for how to create an additional gesture and additional transformation controller for raising and lowering a node that can be checked out here.
It uses a two-finger drag gesture to raise/lower the node.
In general, these were the steps:
One important note: The RaiseController works by raising/lowering a child of the TransformableNode, not the TransformableNode itself. This is so the RaiseController does not conflict with the TranslationController. To make this work, the Renderable is attached to the child of TransformableNode, not the TransformableNode itself.
@dsternfeld7 Thank you, your implementation works exactly as I wanted.
Most helpful comment
I've created a working example for how to create an additional gesture and additional transformation controller for raising and lowering a node that can be checked out here.
It uses a two-finger drag gesture to raise/lower the node.
In general, these were the steps:
One important note: The RaiseController works by raising/lowering a child of the TransformableNode, not the TransformableNode itself. This is so the RaiseController does not conflict with the TranslationController. To make this work, the Renderable is attached to the child of TransformableNode, not the TransformableNode itself.