upd
This commit is contained in:
parent
4d212f2ff8
commit
40df9e5735
@ -87,6 +87,8 @@ public sealed class Dedugan : Component
|
|||||||
{
|
{
|
||||||
base.OnFixedUpdate();
|
base.OnFixedUpdate();
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
if ( OverrideGravity == Vector3.Zero )
|
if ( OverrideGravity == Vector3.Zero )
|
||||||
{
|
{
|
||||||
_directionToAxis = Vector3.VectorPlaneProject(WorldPosition, Vector3.Right).Normal;
|
_directionToAxis = Vector3.VectorPlaneProject(WorldPosition, Vector3.Right).Normal;
|
||||||
@ -97,6 +99,8 @@ public sealed class Dedugan : Component
|
|||||||
_directionToAxis = OverrideGravity;
|
_directionToAxis = OverrideGravity;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
_up = -_directionToAxis;
|
_up = -_directionToAxis;
|
||||||
_forward = Vector3.Right;
|
_forward = Vector3.Right;
|
||||||
_right = Vector3.Cross(_up, _forward).Normal;
|
_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;
|
if (!AnimationHelper.IsValid()) return;
|
||||||
AnimationHelper.DuckLevel = IsDucking;
|
AnimationHelper.DuckLevel = IsDucking;
|
||||||
@ -186,9 +197,18 @@ public sealed class Dedugan : Component
|
|||||||
|
|
||||||
void RotateCamera()
|
void RotateCamera()
|
||||||
{
|
{
|
||||||
var cameraOffset = CameraPivot.LocalPosition + CameraPivot.LocalRotation.Backward * (CamOffsetX + EyeAngles.pitch * .5f);
|
if ( RagdollController.Enabled )
|
||||||
Camera.LocalRotation = EyeAngles.ToRotation();
|
{
|
||||||
Camera.LocalPosition = cameraOffset * Camera.LocalRotation;
|
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;
|
||||||
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
|
|||||||
Loading…
x
Reference in New Issue
Block a user