ITS BROKEN

This commit is contained in:
Jan Racek
2026-03-29 16:14:15 +02:00
parent 7c344e2e37
commit 9a82f9e3a1
10 changed files with 179 additions and 50 deletions

View File

@@ -59,8 +59,8 @@ bool CutscenePlayer::play(const char* name, bool loop) {
track.initialValues[2] = (int16_t)track.target->position.z.value;
}
break;
case TrackType::ObjectRotationY:
// TODO: I added this. Then realized that it only stores rotation matrix. That sucks. To anyone who finds this Pull requests are open :P
case TrackType::ObjectRotation:
// Initial rotation angles: 0,0,0 (no way to extract Euler from matrix)
break;
case TrackType::ObjectActive:
if (track.target) {
@@ -289,7 +289,7 @@ void CutscenePlayer::applyTrack(CutsceneTrack& track) {
case TrackType::CameraRotation: {
if (!m_camera) return;
lerpAngles(track.keyframes, track.keyframeCount, track.initialValues, out);
lerpKeyframes(track.keyframes, track.keyframeCount, track.initialValues, out);
psyqo::Angle rx, ry, rz;
rx.value = (int32_t)out[0];
ry.value = (int32_t)out[1];
@@ -307,13 +307,18 @@ void CutscenePlayer::applyTrack(CutsceneTrack& track) {
break;
}
case TrackType::ObjectRotationY: {
case TrackType::ObjectRotation: {
if (!track.target) return;
lerpAngles(track.keyframes, track.keyframeCount, track.initialValues, out);
psyqo::Angle yAngle;
yAngle.value = (int32_t)out[1];
track.target->rotation = psyqo::SoftMath::generateRotationMatrix33(
yAngle, psyqo::SoftMath::Axis::Y, m_trig);
lerpKeyframes(track.keyframes, track.keyframeCount, track.initialValues, out);
psyqo::Angle rx, ry, rz;
rx.value = (int32_t)out[0];
ry.value = (int32_t)out[1];
rz.value = (int32_t)out[2];
auto matY = psyqo::SoftMath::generateRotationMatrix33(ry, psyqo::SoftMath::Axis::Y, m_trig);
auto matX = psyqo::SoftMath::generateRotationMatrix33(rx, psyqo::SoftMath::Axis::X, m_trig);
auto matZ = psyqo::SoftMath::generateRotationMatrix33(rz, psyqo::SoftMath::Axis::Z, m_trig);
auto temp = psyqo::SoftMath::multiplyMatrix33(matY, matX);
track.target->rotation = psyqo::SoftMath::multiplyMatrix33(temp, matZ);
break;
}