From 8247af1c8693e024f49e59cc72a4b1c4b1477c3d Mon Sep 17 00:00:00 2001 From: Fernando Cortez Date: Tue, 10 Sep 2024 15:13:19 -0400 Subject: [PATCH] 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 fb00037ce..5d56a07e0 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 d8f1710ea..ee9a0c31b 100644 --- a/Experimental/DistributedAuthoritySample/Assets/Scripts/Physics/PhysicsPlayerController.cs +++ b/Experimental/DistributedAuthoritySample/Assets/Scripts/Physics/PhysicsPlayerController.cs @@ -71,13 +71,13 @@ void ApplyMovement() { // 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?