Bound Hands - oneMillionWorlds/Tamarin GitHub Wiki

Much of Tamarin functionality is exposed through bound hands. A Bound hand is a geometry with an armature which has been persistently bound to a hand pose and skeleton such that the in game hand is constantly updated to match the users hand position. This is implemented as an app state so the hands are available from across your application once bound.

@Override
public void simpleInitApp(){
   VRHandsAppState vrHandsAppState = new VRHandsAppState(assetManager, getStateManager().getState(ActionBasedOpenVrState.class));
   getStateManager().attach(vrHandsAppState);

   Spatial handLeft =assetManager.loadModel("Tamarin/Models/basicHands_left.j3o");
   BoundHand boundHandLeft = vrHandsAppState.bindHandModel("/actions/main/in/HandPoseLeft", "/actions/main/in/HandSkeletonLeft", handLeft, HandSide.LEFT);

   Material mat = new Material(assetManager, "Common/MatDefs/Misc/Unshaded.j3md");
   mat.setTexture("ColorMap", assetManager.loadTexture("Tamarin/Textures/basicHands_left_referenceTexture.png"));
   boundHandLeft.setMaterial(mat);

}

Once the hands are bound that opens up Picking and Grabbing functionality

Hand models

Tamarin/Models/basicHands_left.j3o and Tamarin/Models/basicHands_right.j3o are included within Tamarin so can be used as starter hands, as are the referenceTextures. Alternatively the included blender files can be used as a starting point for your own hand models.

Hand models from blender

Starting from the blender files the j3o format hand models were created by exporting from blender in gltf format (aka .glb) with +Y up setting, loading those into an application (required org.jmonkeyengine:jme3-plugins) and then saving them back out with the BinaryExporter. j3o models load faster and so are better to include in your final project distribution than .glb

Coordinate systems

Bulk hand coordinate system

This is the coordinate system that the whole hand is pointing it, its position and axes depend on the type of pose used to create the hand (aim or grip) but +x points "forwards" either along the aim line or along the line of a held sword.

It's node can be obtained as

boundHand.getHandNode_xPointing()

Palm coordinate system

This coordinate system tracks the middle finger metacarpel bone (centre of)

palm coordinate system