From 40df9e573551685a5a5b68cad51313ec148f8569 Mon Sep 17 00:00:00 2001 From: Oscar Date: Sun, 25 May 2025 19:36:34 +0300 Subject: [PATCH] upd --- Code/Player/Dedugan.cs | 28 ++++++++++++++++++++++++---- 1 file changed, 24 insertions(+), 4 deletions(-) diff --git a/Code/Player/Dedugan.cs b/Code/Player/Dedugan.cs index c9d6235..e63440b 100644 --- a/Code/Player/Dedugan.cs +++ b/Code/Player/Dedugan.cs @@ -87,6 +87,8 @@ public sealed class Dedugan : Component { base.OnFixedUpdate(); + + if ( OverrideGravity == Vector3.Zero ) { _directionToAxis = Vector3.VectorPlaneProject(WorldPosition, Vector3.Right).Normal; @@ -97,6 +99,8 @@ public sealed class Dedugan : Component _directionToAxis = OverrideGravity; } + + _up = -_directionToAxis; _forward = Vector3.Right; _right = Vector3.Cross(_up, _forward).Normal; @@ -129,7 +133,14 @@ public sealed class Dedugan : Component } - Controller.Move(); + if ( !RagdollController.Enabled ) + { + Controller.Move(); + } + else + { + Controller.Velocity = 0; + } if (!AnimationHelper.IsValid()) return; AnimationHelper.DuckLevel = IsDucking; @@ -186,9 +197,18 @@ public sealed class Dedugan : Component void RotateCamera() { - var cameraOffset = CameraPivot.LocalPosition + CameraPivot.LocalRotation.Backward * (CamOffsetX + EyeAngles.pitch * .5f); - Camera.LocalRotation = EyeAngles.ToRotation(); - Camera.LocalPosition = cameraOffset * Camera.LocalRotation; + if ( RagdollController.Enabled ) + { + var cameraOffset = RagdollController.WorldRotation.Up * 20f - Camera.WorldRotation.Forward * 200f;//RagdollController.LocalPosition + RagdollController.LocalRotation.Backward * (CamOffsetX + EyeAngles.pitch * .5f); + Camera.WorldPosition = Vector3.Lerp( Camera.WorldPosition, RagdollController.WorldPosition + cameraOffset, Time.Delta * 5f); + Camera.LocalRotation = Rotation.Lerp(Camera.LocalRotation, EyeAngles.ToRotation(), Time.Delta * 2f); + } + else + { + Camera.LocalRotation = EyeAngles.ToRotation(); + var cameraOffset = CameraPivot.LocalPosition + CameraPivot.LocalRotation.Backward * (CamOffsetX + EyeAngles.pitch * .5f); + Camera.LocalPosition = cameraOffset * Camera.LocalRotation; + } }