fr.jeanf.universal.player 0.8.51 → 0.8.52
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
|
@@ -15,8 +15,6 @@ namespace jeanf.universalplayer
|
|
|
15
15
|
[SerializeField] LayerMask ignoreTheseOnGrab;
|
|
16
16
|
GameObject pokeInteractor;
|
|
17
17
|
[SerializeField] HandType handType;
|
|
18
|
-
Vector3 targetPos;
|
|
19
|
-
Quaternion targetRot;
|
|
20
18
|
|
|
21
19
|
[SerializeField] VoidEventChannelSO controlSchemeChangeEvent;
|
|
22
20
|
|
|
@@ -46,9 +44,6 @@ namespace jeanf.universalplayer
|
|
|
46
44
|
}
|
|
47
45
|
private void Update()
|
|
48
46
|
{
|
|
49
|
-
targetPos = target.transform.position;
|
|
50
|
-
targetRot = target.transform.rotation;
|
|
51
|
-
|
|
52
47
|
float distance = Vector3.Distance(transform.position, target.position);
|
|
53
48
|
if (distance > showNonPhysicalHandDistance)
|
|
54
49
|
{
|
|
@@ -61,29 +56,15 @@ namespace jeanf.universalplayer
|
|
|
61
56
|
}
|
|
62
57
|
void FixedUpdate()
|
|
63
58
|
{
|
|
64
|
-
|
|
65
|
-
Vector3 posDelta = targetPos - transform.position;
|
|
66
|
-
rb.linearVelocity = posDelta / Time.fixedDeltaTime;
|
|
67
|
-
|
|
68
|
-
Quaternion currentRotation = transform.rotation * offset;
|
|
69
|
-
Quaternion rotationDiff = targetRot * Quaternion.Inverse(currentRotation);
|
|
70
|
-
|
|
71
|
-
rotationDiff.ToAngleAxis(out float angleDeg, out Vector3 axis);
|
|
72
|
-
|
|
73
|
-
if (!float.IsInfinity(axis.x))
|
|
74
|
-
{
|
|
75
|
-
float angleRad = angleDeg * Mathf.Deg2Rad;
|
|
76
|
-
rb.angularVelocity = axis * (angleRad / Time.fixedDeltaTime);
|
|
77
|
-
}
|
|
78
|
-
//rb.linearVelocity = (target.position - transform.position)/Time.fixedDeltaTime;
|
|
59
|
+
rb.linearVelocity = (target.position - transform.position) / Time.fixedDeltaTime;
|
|
79
60
|
|
|
80
61
|
|
|
81
|
-
|
|
82
|
-
|
|
62
|
+
Quaternion rotationDifference = target.rotation * Quaternion.Inverse(transform.rotation * offset);
|
|
63
|
+
rotationDifference.ToAngleAxis(out float angleInDegree, out Vector3 rotationAxis);
|
|
83
64
|
|
|
84
|
-
|
|
65
|
+
Vector3 rotationDifferenceInDegree = angleInDegree * rotationAxis;
|
|
85
66
|
|
|
86
|
-
|
|
67
|
+
rb.angularVelocity = (rotationDifferenceInDegree * Mathf.Deg2Rad / Time.deltaTime);
|
|
87
68
|
}
|
|
88
69
|
|
|
89
70
|
private void CheckXRStatus()
|