fix: Distributed Authority Sample - Jitter on FixedJoint connected body [MTT-9071] (#222)

different force application to locomotion fixing child joint jitter
This commit is contained in:
Fernando Cortez 2024-09-11 10:07:52 -04:00 коммит произвёл GitHub
Родитель a09b8eee22
Коммит 56845f95a7
Не найден ключ, соответствующий данной подписи
Идентификатор ключа GPG: B5690EEEBB952194
2 изменённых файлов: 4 добавлений и 4 удалений

Просмотреть файл

@ -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

Просмотреть файл

@ -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?