code to convert / Synchronize Oculus hand object from three.js to Unity
Budget: $30 – $250 USD
I would like to synchronize oculus hand object from three.js to Unity.
The hand objects at three.js side is moved by Hand tracking functionality of Oculus quest2 in the VR Space.
Which require convert each finger bones matrix4x4(quaternions/rotations) from
Right-handed coordinates(three.js) to Light-handed coordinates(unity).
position converting and scale converting are desirable but not must.
rotation/quaternion converting is the must.
I expect that someone has already done the same things and not would like to reinventing the wheel.
I expect the deliverable is (mainly) C# script which have the reference to the hand objects (probably b_r_wrist /b_l_wrist) , which parse ,convert matrix and set them to Unity hand objects
Unity 2019.4 or later
three.js r127
[three.js side]
OculusHandModel.js - XRHandMeshModel.js
import { XRControllerModelFactory } from '../jsm/webxr/XRControllerModelFactory.js';
import { XRHandModelFactory } from '../jsm/webxr/XRHandModelFactory.js';
import { OculusHandModel } from '../jsm/webxr/OculusHandModel.js'
hand1 = renderer.xr.getHand( 0 );
handModel1 = new OculusHandModel( hand1 );
hand1.add( handModel1 );
scene.add( hand1 );
hand2 = renderer.xr.getHand( 1 );
handModel2 = new OculusHandModel( hand2 );
hand2.add( handModel2 );
scene.add( hand2 );
====send information by websocket somthing like below=====
const hand1_joints = hand1.joints;
const hand2_joints = hand2.joints;
let msg_str = "";
if (controller1_is_Right == false){
msg_str = JSON.stringify(hand1_joints) + "___" + JSON.stringify(hand2_joints);
} else {
msg_str = JSON.stringify(hand2_joints) + "___" + JSON.stringify(hand1_joints);
}
websock_conn_01.send(msg_str);
[unity side]
Use OVRCustomHandPrefab_L and OVRCustomHandPrefab_R
parse recieved info from three.js
set matrix4x4/quarternion/rotation info from three.js to each relevant bones of the hands.
target bones b_r_wrist /b_l_wrist and children.
I would appreciate if you help me.
Thanks in advance!
The hand objects at three.js side is moved by Hand tracking functionality of Oculus quest2 in the VR Space.
Which require convert each finger bones matrix4x4(quaternions/rotations) from
Right-handed coordinates(three.js) to Light-handed coordinates(unity).
position converting and scale converting are desirable but not must.
rotation/quaternion converting is the must.
I expect that someone has already done the same things and not would like to reinventing the wheel.
I expect the deliverable is (mainly) C# script which have the reference to the hand objects (probably b_r_wrist /b_l_wrist) , which parse ,convert matrix and set them to Unity hand objects
Unity 2019.4 or later
three.js r127
[three.js side]
OculusHandModel.js - XRHandMeshModel.js
import { XRControllerModelFactory } from '../jsm/webxr/XRControllerModelFactory.js';
import { XRHandModelFactory } from '../jsm/webxr/XRHandModelFactory.js';
import { OculusHandModel } from '../jsm/webxr/OculusHandModel.js'
hand1 = renderer.xr.getHand( 0 );
handModel1 = new OculusHandModel( hand1 );
hand1.add( handModel1 );
scene.add( hand1 );
hand2 = renderer.xr.getHand( 1 );
handModel2 = new OculusHandModel( hand2 );
hand2.add( handModel2 );
scene.add( hand2 );
====send information by websocket somthing like below=====
const hand1_joints = hand1.joints;
const hand2_joints = hand2.joints;
let msg_str = "";
if (controller1_is_Right == false){
msg_str = JSON.stringify(hand1_joints) + "___" + JSON.stringify(hand2_joints);
} else {
msg_str = JSON.stringify(hand2_joints) + "___" + JSON.stringify(hand1_joints);
}
websock_conn_01.send(msg_str);
[unity side]
Use OVRCustomHandPrefab_L and OVRCustomHandPrefab_R
parse recieved info from three.js
set matrix4x4/quarternion/rotation info from three.js to each relevant bones of the hands.
target bones b_r_wrist /b_l_wrist and children.
I would appreciate if you help me.
Thanks in advance!