From c120be0bcc5a19457d13a6ceab480cc6623ba4a2 Mon Sep 17 00:00:00 2001 From: Aaron Kimbrell Date: Tue, 29 Sep 2026 09:19:57 -0500 Subject: [PATCH] fix(scripts): concert instruments place the player as live did (issue 1256) RepositionPlayer added the offsets in world X/Z, set the height to 0 and built the keyboard turn around the position vector. As l_ns_concert_instrument_qb.lua: the offset is in the instrument's own frame, the instrument's height is kept, the player faces the instrument's way, and at the keyboard turns -0.8 further. Check: build and play all four instruments on the Nimbus Station stage: the player stands at each one facing it, not below the stage. Co-Authored-By: Claude Opus 5.5 --- dScripts/ai/NS/NsConcertInstrument.cpp | 23 ++++++++++++++--------- 1 file changed, 14 insertions(+), 9 deletions(-) diff --git a/dScripts/ai/NS/NsConcertInstrument.cpp b/dScripts/ai/NS/NsConcertInstrument.cpp index 2189fbd78..b6ff76aae 100644 --- a/dScripts/ai/NS/NsConcertInstrument.cpp +++ b/dScripts/ai/NS/NsConcertInstrument.cpp @@ -267,26 +267,31 @@ void NsConcertInstrument::UnEquipInstruments(Entity* self, Entity* player) { } void NsConcertInstrument::RepositionPlayer(Entity* self, Entity* player) { - auto position = self->GetPosition(); - auto rotation = self->GetRotation(); - position.SetY(0.0f); + // As l_ns_concert_instrument_qb.lua: the offset is in the instrument's own frame (GetParallelPosition), the + // instrument's height is kept, the player faces the way the instrument does, and at the keyboard turns -0.8 + // further (OrientToAngle relative to that) + const auto rotation = self->GetRotation(); + float right = 0.0f; + float forward = 0.0f; + auto playerRotation = rotation; switch (GetInstrumentLot(self)) { case Bass: case Guitar: - position.SetX(position.GetX() + 5.0f); + right = 5.0f; break; case Keyboard: - position.SetX(position.GetX() - 0.45f); - position.SetZ(position.GetZ() + 0.75f); - rotation = QuatUtils::AxisAngle(position, -0.8f); // Slight rotation to make the animation sensible + right = -0.45f; + forward = 0.75f; + playerRotation = rotation * QuatUtils::AxisAngle(NiPoint3Constant::UNIT_Y, -0.8f); break; case Drum: - position.SetZ(position.GetZ() - 0.5f); + forward = -0.5f; break; } - GameMessages::Teleport(player->GetObjectID(), position, rotation).SendToClient(player->GetSystemAddress()); + const NiPoint3 position = self->GetPosition() + NiPoint3(QuatUtils::Right(rotation)) * right + NiPoint3(QuatUtils::Forward(rotation)) * forward; + GameMessages::Teleport(player->GetObjectID(), position, playerRotation).SendToClient(player->GetSystemAddress()); } InstrumentLot NsConcertInstrument::GetInstrumentLot(Entity* self) {