Hi
I am trying to add additional interaction in addition to getPinchStrength , which works but still bit difficult for user to use this for holding objects or nodes
So i was looking for a collision detection , i.e when a user ( blue hands ) collides or touches an object , should detect it and trigger a function
This i found with vrDeviceService.getLeftTrackedHand() and vrDeviceService.deviceCollisionStarted
But the trigger doesnt seem to work as expected , any tips ?
Solved! Go to Solution.
Solved by __daniel.lincoln__. Go to Solution.
Hello,
Here is a basic example of how I configured it based on the animated gif from the related post.
https://forums.autodesk.com/t5/vred-forum/grab-and-move-objects-with-vrhands/td-p/11224050
# Pick up objects using the Pinch gesture
# 1 - Execute while viewing Varjo Tracked Hands
# 2 - Open VR Menu and select this Variant Set
# 3 - Pinch the cube with the right hand to grab, unpinch to release
def rh_check_if_colliding():
if rh_collider.isColliding():
rh_box_constraint.setActive(True)
def check_pinch_strength():
if rh_tracked.getPinchStrength() < 1.0: # Release cube
rh_box_constraint.setActive(False)
elif rh_tracked.getPinchStrength() == 1.0: # Pick up cube
rh_check_if_colliding()
rh_tracked = vrDeviceService.getRightTrackedHand()
rh_index = vrNodeService.findNode("R_index_collision_geo", root=getInternalRootNode())
test_node = vrNodeService.findNode('PinchBox')
if not test_node.isValid():
# Create box near RH index finger location
box_initial_pos = rh_index.getWorldTranslation()
box = createNode("Transform3D", "PinchBox", False)
box.addChild(createBox(45, 45, 45, 1, 1, 1, 0.0, 1.0, 0.0, 0.0))
box.setTranslation(box_initial_pos.x(), box_initial_pos.y(), box_initial_pos.z() + 100)
# Create Constraints
rh_box_constraint = vrConstraintService.createParentConstraint([rh_index.getParent()], box, False)
# Create Collisions
rh_collider = vrCollision([box], [rh_index])
rh_collider.connect(rh_check_if_colliding)
# Create timer to monitor pinch strength
timer = vrTimer()
timer.connect(check_pinch_strength)
timer.setActive(True)
Regards,
Dan
thanks for the response
box_initial_pos = rh_index.getWorldTranslation()
here i get an error
and reading docu, i see that this ( findNode ) returns vrNode and not vrdTransformNode.
And getWorldTranslation is a function of vrdTransformNode
I am Trying to resolve this...
Ok, the script needs to be executed while in Varjo HMD mode and hands are visible.
Can't find what you're looking for? Ask the community or share your knowledge.