Skip to content
This repository was archived by the owner on Apr 3, 2023. It is now read-only.

Commit 38937bd

Browse files
committed
Inverse Hand Position
1 parent 198d6c3 commit 38937bd

File tree

2 files changed

+6
-4
lines changed

2 files changed

+6
-4
lines changed

Assets/Example/Scenes/Hand Control Example.unity

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -419,3 +419,4 @@ MonoBehaviour:
419419
m_Script: {fileID: 11500000, guid: f12be339cb6d39346b02224594b6c0f9, type: 3}
420420
m_Name:
421421
m_EditorClassIdentifier:
422+
sign: 1

Assets/IRToolkit/Scripts/HandPositionManager.cs

Lines changed: 5 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -14,9 +14,10 @@ enum State
1414

1515
HandManager handManager;
1616
State leftHandState, rightHandState;
17+
public int sign = 1;
1718

18-
// Update is called once per frame
19-
void Update () {
19+
// Update is called once per frame
20+
void Update () {
2021
UpdateHandPosition();
2122
}
2223

@@ -36,12 +37,12 @@ void UpdateHandPosition()
3637
{
3738
if (hand.BodySide == BodySideType.BODY_SIDE_LEFT)
3839
{
39-
Boardcast("OnLeftHandChange", new Vector3(hand.MassCenterWorld.x, hand.MassCenterWorld.y, hand.MassCenterWorld.z));
40+
Boardcast("OnLeftHandChange", new Vector3(hand.MassCenterWorld.x* sign, hand.MassCenterWorld.y , hand.MassCenterWorld.z ));
4041
isLeftAppear = State.Appear;
4142
}
4243
else if (hand.BodySide == BodySideType.BODY_SIDE_RIGHT)
4344
{
44-
Boardcast("OnRightHandChange", new Vector3(hand.MassCenterWorld.x, hand.MassCenterWorld.y, hand.MassCenterWorld.z));
45+
Boardcast("OnRightHandChange", new Vector3(hand.MassCenterWorld.x * sign, hand.MassCenterWorld.y , hand.MassCenterWorld.z ));
4546
isRightAppear = State.Appear;
4647
}
4748
}

0 commit comments

Comments
 (0)