From 56845f95a776c937e081b5a86f16f2823e8647ed Mon Sep 17 00:00:00 2001 From: Fernando Cortez Date: Wed, 11 Sep 2024 10:07:52 -0400 Subject: [PATCH] fix: Distributed Authority Sample - Jitter on FixedJoint connected body [MTT-9071] (#222) different force application to locomotion fixing child joint jitter --- .../AvatarPhysicsPlayerControllerSettings.asset | 4 ++-- .../Assets/Scripts/Physics/PhysicsPlayerController.cs | 4 ++-- 2 files changed, 4 insertions(+), 4 deletions(-) diff --git a/Experimental/DistributedAuthoritySample/Assets/ScriptableObjects/AvatarPhysicsPlayerControllerSettings.asset b/Experimental/DistributedAuthoritySample/Assets/ScriptableObjects/AvatarPhysicsPlayerControllerSettings.asset index fb00037c..5d56a07e 100644 --- a/Experimental/DistributedAuthoritySample/Assets/ScriptableObjects/AvatarPhysicsPlayerControllerSettings.asset +++ b/Experimental/DistributedAuthoritySample/Assets/ScriptableObjects/AvatarPhysicsPlayerControllerSettings.asset @@ -12,8 +12,8 @@ MonoBehaviour: m_Script: {fileID: 11500000, guid: 48976c2ba473849eab61b8e1398b8644, type: 3} m_Name: AvatarPhysicsPlayerControllerSettings m_EditorClassIdentifier: - WalkSpeed: 6 - SprintSpeed: 10 + WalkSpeed: 18 + SprintSpeed: 30 Acceleration: 50 DragCoefficient: 4 AirControlFactor: 0.5 diff --git a/Experimental/DistributedAuthoritySample/Assets/Scripts/Physics/PhysicsPlayerController.cs b/Experimental/DistributedAuthoritySample/Assets/Scripts/Physics/PhysicsPlayerController.cs index d8f1710e..ee9a0c31 100644 --- a/Experimental/DistributedAuthoritySample/Assets/Scripts/Physics/PhysicsPlayerController.cs +++ b/Experimental/DistributedAuthoritySample/Assets/Scripts/Physics/PhysicsPlayerController.cs @@ -71,13 +71,13 @@ namespace Unity.Multiplayer.Samples.SocialHub.Physics { // Apply force proportional to acceleration while grounded var force = velocityChange * m_PhysicsPlayerControllerSettings.Acceleration; - m_Rigidbody.AddForce(force, ForceMode.Acceleration); + m_Rigidbody.AddForce(force, ForceMode.Force); } else { // Apply reduced force in the air for air control var force = velocityChange * (m_PhysicsPlayerControllerSettings.Acceleration * m_PhysicsPlayerControllerSettings.AirControlFactor); - m_Rigidbody.AddForce(force, ForceMode.Acceleration); + m_Rigidbody.AddForce(force, ForceMode.Force); } // maybe add magnitude check?