trying to figure out a camera stutter bug

This commit is contained in:
2025-09-15 16:24:51 +02:00
parent d8ff9c0964
commit 735e128a95
5 changed files with 30 additions and 28 deletions

View File

@@ -54,8 +54,7 @@ namespace RebootReality.jelycho.Player {
}
void Awake() {
m_NoiseComponent =
Camera.GetCinemachineComponent(CinemachineCore.Stage.Noise) as CinemachineBasicMultiChannelPerlin;
m_NoiseComponent = Camera.GetCinemachineComponent(CinemachineCore.Stage.Noise) as CinemachineBasicMultiChannelPerlin;
Assert.IsNotNull(m_NoiseComponent);
SetBobbing(0.0f);

View File

@@ -433,7 +433,7 @@ namespace RebootReality.jelycho.Player {
InterpolateActorState(deltaTime);
}
TickCharacterRotation();
TickCharacterRotation(deltaTime);
}
protected override void OnActorCommandServer(ulong senderID, ActorCommand actorCommand) {
@@ -638,12 +638,13 @@ namespace RebootReality.jelycho.Player {
m_CurrentCameraBobbing = Mathf.MoveTowards(m_CurrentCameraBobbing,
m_TargetCameraBobbing,
m_CameraBobbingTransitionSpeed * deltaTime);
m_Camera.SetBobbing(m_CurrentCameraBobbing);
// m_Camera.SetBobbing(m_CurrentCameraBobbing);
m_Camera.SetBobbing(0.0f);
m_CameraSpring.UpdateSpring(deltaTime,
m_CharacterForwardTransform.up,
m_CharacterForwardTransform.right,
m_CharacterForwardTransform.forward);
// m_CameraSpring.UpdateSpring(deltaTime,
// m_CharacterForwardTransform.up,
// m_CharacterForwardTransform.right,
// m_CharacterForwardTransform.forward);
}
void SenseInteractable() {
@@ -823,7 +824,7 @@ namespace RebootReality.jelycho.Player {
//
// @MARK: Common
//
void TickCharacterRotation() {
void TickCharacterRotation(float dt) {
float angleDeg = Mathf.DeltaAngle(m_Camera.Yaw, m_Locomotion.YawRotation);
bool rotateCharacter = false;
@@ -846,12 +847,13 @@ namespace RebootReality.jelycho.Player {
}
if (rotateCharacter) {
m_CharacterTurnVelocity = rotateCharacterSpeed * Time.deltaTime;
m_CharacterTurnVelocity = rotateCharacterSpeed * dt;
m_CharacterTurnVelocitySmooth = m_CharacterTurnVelocity;
m_Locomotion.YawRotation = Mathf.MoveTowardsAngle(m_Locomotion.YawRotation,
float newYaw = Mathf.MoveTowardsAngle(m_Locomotion.YawRotation,
m_Camera.Yaw,
m_CharacterTurnVelocity);
m_Locomotion.YawRotation = newYaw;
}
// Aim Target adjustment

View File

@@ -97,13 +97,13 @@ namespace RebootReality.jelycho.Player {
public IPlayable Build(PlayableGraph graph) {
m_Mixer = AnimationMixerPlayable.Create(graph, 7);
AnimationClipPlayable idlePlayable = AnimationClipPlayable.Create(graph, m_IdleClip);
AnimationClipPlayable runForwardPlayable = AnimationClipPlayable.Create(graph, m_RunForwardClip);
AnimationClipPlayable runBackwardsPlayable = AnimationClipPlayable.Create(graph, m_RunBackwardsClip);
AnimationClipPlayable strafeRightPlayable = AnimationClipPlayable.Create(graph, m_StrafeRightClip);
AnimationClipPlayable strafeLeftPlayable = AnimationClipPlayable.Create(graph, m_StrafeLeftClip);
AnimationClipPlayable turnRightPlayable = AnimationClipPlayable.Create(graph, m_TurnRightClip);
AnimationClipPlayable turnLeftPlayable = AnimationClipPlayable.Create(graph, m_TurnLeftClip);
var idlePlayable = AnimationClipPlayable.Create(graph, m_IdleClip);
var runForwardPlayable = AnimationClipPlayable.Create(graph, m_RunForwardClip);
var runBackwardsPlayable = AnimationClipPlayable.Create(graph, m_RunBackwardsClip);
var strafeRightPlayable = AnimationClipPlayable.Create(graph, m_StrafeRightClip);
var strafeLeftPlayable = AnimationClipPlayable.Create(graph, m_StrafeLeftClip);
var turnRightPlayable = AnimationClipPlayable.Create(graph, m_TurnRightClip);
var turnLeftPlayable = AnimationClipPlayable.Create(graph, m_TurnLeftClip);
m_Mixer.ConnectInput(0, idlePlayable, 0, 1.0f);
m_Mixer.ConnectInput(1, runForwardPlayable, 0, 0.0f);
@@ -309,8 +309,6 @@ namespace RebootReality.jelycho.Player {
m_IsReady = true;
}
void Update() { }
public void SetLocomotionParams(PlayerLocomotionAnimatorParams locomotionParams) {
if (!m_IsReady) {
return;
@@ -318,7 +316,7 @@ namespace RebootReality.jelycho.Player {
m_LegsLayerMixer.SetLayerWeight(1, locomotionParams.IsGrounded ? 0.0f : 1.0f);
float2 groundBlendDirection = new float2(locomotionParams.VelocityRightNormalized,
var groundBlendDirection = new float2(locomotionParams.VelocityRightNormalized,
locomotionParams.VelocityForwardNormalized);
m_GroundBlendTree.SetInput(groundBlendDirection, locomotionParams.TurnVelocity);
}

View File

@@ -19,7 +19,8 @@
"GUID:15fc0a57446b3144c949da3e2b9737a9",
"GUID:6fa512e17c315dd428ad692183dd0e8c",
"GUID:f2be1b7392ef6cc4eafd0ee8ac7a090a",
"GUID:f0ca7da2c713f5849a8e3326866a5e49"
"GUID:f0ca7da2c713f5849a8e3326866a5e49",
"GUID:7f7d1af65c2641843945d409d28f2e20"
],
"includePlatforms": [],
"excludePlatforms": [],

View File

@@ -772,6 +772,7 @@ MonoBehaviour:
m_Script: {fileID: 11500000, guid: 00a9f9c2ce4a41fdaadcfb24c4233127, type: 3}
m_Name:
m_EditorClassIdentifier:
m_RigBuilder: {fileID: 5341614616933970905}
m_ReAnimator: {fileID: 3871962590503854066}
m_HandsLayerIndex: 2
onQuickAttackFinished:
@@ -817,6 +818,7 @@ MonoBehaviour:
mask: {fileID: 0}
isAdditive: 0
targetWeight: 0
tickMode: 0
references:
version: 2
RefIds: