messing with animations

This commit is contained in:
2025-09-24 12:13:56 +02:00
parent 6083935449
commit 59d521afaf
8 changed files with 1948 additions and 11 deletions

View File

@@ -86,6 +86,14 @@ namespace RebootReality.jelycho.Player {
Pitch = Mathf.Clamp(Pitch, m_PitchMin, m_PitchMax);
Yaw += x * sens;
while (Yaw < 0.0f) {
Yaw += 360.0f;
}
while (Yaw > 360.0f) {
Yaw -= 360.0f;
}
}
public void SetLookDirection(Vector3 forward) {

View File

@@ -1,6 +1,7 @@
using System.Collections.Generic;
using Oddworm.Framework;
using System;
using System.Collections.Generic;
using R3;
using RebootKit.Engine.Extensions;
using RebootKit.Engine.Main;
using RebootKit.Engine.Network;
using RebootKit.Engine.Simulation;
@@ -115,7 +116,7 @@ namespace RebootReality.jelycho.Player {
}
}
List<Actor> m_AdditionalMountedActor = new List<Actor>();
readonly List<Actor> m_AdditionalMountedActor = new List<Actor>();
protected override IActorData CreateActorData() {
return new PlayerActorData { };
@@ -640,7 +641,7 @@ namespace RebootReality.jelycho.Player {
m_CameraBobbingTransitionSpeed * deltaTime);
// m_Camera.SetBobbing(m_CurrentCameraBobbing);
m_Camera.SetBobbing(0.0f);
// m_CameraSpring.UpdateSpring(deltaTime,
// m_CharacterForwardTransform.up,
// m_CharacterForwardTransform.right,
@@ -825,6 +826,9 @@ namespace RebootReality.jelycho.Player {
// @MARK: Common
//
void TickCharacterRotation(float dt) {
float3 targetCharacterForward = math.normalize(LookDirection.With(y: 0.0f));
float3 currentCharacterForward = math.normalize(m_CharacterForwardTransform.forward.With(y: 0.0f));
float angleDeg = Mathf.DeltaAngle(m_Camera.Yaw, m_Locomotion.YawRotation);
bool rotateCharacter = false;
@@ -845,14 +849,21 @@ namespace RebootReality.jelycho.Player {
if (!rotateCharacter && math.abs(velocityForward) > 0.01f) {
rotateCharacter = true;
}
if (rotateCharacter) {
m_CharacterTurnVelocity = rotateCharacterSpeed * dt;
m_CharacterTurnVelocitySmooth = m_CharacterTurnVelocity;
// var newForward = Vector3.RotateTowards(currentCharacterForward,
// targetCharacterForward,
// math.radians(m_CharacterTurnVelocity),
// 0.0f);
// m_CharacterForwardTransform.forward = newForward;
float newYaw = Mathf.MoveTowardsAngle(m_Locomotion.YawRotation,
m_Camera.Yaw,
m_CharacterTurnVelocity);
newYaw = m_Camera.Yaw;
// s_Logger.Info($"YAW: {newYaw}");
m_Locomotion.YawRotation = newYaw;
}

View File

@@ -104,7 +104,7 @@ namespace RebootReality.jelycho.Player {
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);
m_Mixer.ConnectInput(2, runBackwardsPlayable, 0, 0.0f);