HandPhysics only really works at slow speeds #10610
steven-cerebralfix
started this conversation in
General
Replies: 0 comments
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
-
I've been messing with the HandPhysics service. I want to be able to swipe my hand across a scene and push away objects. This works ok when I move slowly but not fast.
I made some adjustments JointKinematicBody.cs
63: //transform.position = Joint.position;
64: //transform.rotation = Joint.rotation;
63: _rigidBody.MovePosition(Joint.position);
64: _rigidBody.MoveRotation(Joint.rotation);
(I exposed _rigidBody in JointKinematicBody.cs
I believe this is the intended way of moving a rigid body.
https://docs.unity3d.com/ScriptReference/Rigidbody.MovePosition.html
I believe this should also be updated using FixedUpdate, not Update. To make that change quite a few classes need changing.
One of these classes is BaseServiceManager.cs. I noticed in here there is a typo where if (Application.isPlaying) is duplicated.
private void LateUpdate()
{
if (Application.isPlaying)
{
if (Application.isPlaying)
{
foreach (IMixedRealityService service in registeredServices.Values)
{
service.LateUpdate();
}
}
}
}
This works much better, and now I can swipe stuff at high speeds.
Not sure what to do with all this information. I've made my changes to the HandPhysicsService locally in my project. Exposing FixedUpdate is a bit harder as that is deep in the MRTK engine code. It would be great if the FixedUpdate function support could be added.
If you were to make these changes in the engine it changes the behavior significantly. It might break a lot of peoples experiences if they've already used it and worked around the behavior.
Beta Was this translation helpful? Give feedback.
All reactions