Description
TL;DR I created a hackathon project based on this project and https://github.com/homuler/MediaPipeUnityPlugin. The idea is to run the mediapipe graph directly in Unity, and use AnimationRigging as shown in this project to control the animation.
Here is how I call into the LandmarkResultSet
. The (x,y) coordinate from NormalizedLandmarkList
looks expected (x coordinate changes for left/right, y coordinate for up/down)
private void OnHandLandmarksOutput(List<NormalizedLandmarkList> handLandmarks)
{
if (handLandmarks != null) {
// Logger.LogInfo(_TAG, handLandmarks[0]);
resultSet.UpdateLandmark(LandmarkInterface.LandmarkType.LeftHand, handLandmarks[0]); // only use lefthand for testing for now
}
}
I also simplified LandmarkOrientation
, rather than taking the orientation from LandmarkResultSet
which was set from the socket, I config it using a Vector3 field in Inspector, for my testing purpose.
private void updateOrientation(Vector3 orientation) // orientation is from the Inspector
{
this.transform.localEulerAngles = orientation;
}
I copied the placement of the UnityChan GameObject from the sample scene - except one change - my main camera has Vector3.zero rotation, and my unitychan's rotation is (0, 180, 0). The sample scene has unitychan at Vector3.zero rotation, and main camera reverted. Everything in the unitychan hierarchy is cloned, including HandLandmarkAndRigs
sub gameobject attached to the main character. I'm not sure if this is relevant but would like to point out.
Playing in the editor is as followed gif: The x,y coordinates look swapped unexpectedly, e.g. when I was actually moving my arm to the left (webcam), the UnityChan is moving it downwards, like every coordinate in the hand landmark is rotated counter clockwise along the z-axis. However I am not able to figure out exactly what I missed. Is there any logic that assumed the coordination system on a phone so I should have it corrected when debugging using a webcam in Unity Editor? Or any other ideas how I can further debug the coordinate system? Thank you.