File tree Expand file tree Collapse file tree 1 file changed +7
-2
lines changed
Packages/webxr-interactions/Runtime/Scripts Expand file tree Collapse file tree 1 file changed +7
-2
lines changed Original file line number Diff line number Diff line change @@ -45,6 +45,9 @@ public class ControllerInteraction : MonoBehaviour
45
45
private string loadedHandProfile = null ;
46
46
private Dictionary < int , Transform > handModelJoints = new Dictionary < int , Transform > ( ) ;
47
47
private static Quaternion quat180 = Quaternion . Euler ( 0 , 180 , 0 ) ;
48
+
49
+ private Vector3 currentVelocity ;
50
+ private Vector3 previousPos ;
48
51
#endif
49
52
50
53
private void Awake ( )
@@ -283,7 +286,9 @@ private void OnHandUpdate(WebXRHandData handData)
283
286
return ;
284
287
}
285
288
Quaternion rotationOffset = Quaternion . Inverse ( handData . joints [ 0 ] . rotation ) ;
286
-
289
+ currentVelocity = ( transform . position - previousPos ) / Time . deltaTime ;
290
+ previousPos = transform . position ;
291
+
287
292
#if WEBXR_INPUT_PROFILES
288
293
if ( useInputProfile && loadedHandModel )
289
294
{
@@ -512,7 +517,7 @@ public void Drop()
512
517
{
513
518
if ( ! currentRigidBody )
514
519
return ;
515
-
520
+ currentRigidBody . velocity = currentVelocity ;
516
521
attachJoint . connectedBody = null ;
517
522
currentRigidBody = null ;
518
523
}
You can’t perform that action at this time.
0 commit comments