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 <noreply@anthropic.com>
This commit is contained in:
Aaron Kimbrell
2026-09-29 09:19:57 -05:00
parent dceec20ac2
commit c120be0bcc

View File

@@ -267,26 +267,31 @@ void NsConcertInstrument::UnEquipInstruments(Entity* self, Entity* player) {
} }
void NsConcertInstrument::RepositionPlayer(Entity* self, Entity* player) { void NsConcertInstrument::RepositionPlayer(Entity* self, Entity* player) {
auto position = self->GetPosition(); // As l_ns_concert_instrument_qb.lua: the offset is in the instrument's own frame (GetParallelPosition), the
auto rotation = self->GetRotation(); // instrument's height is kept, the player faces the way the instrument does, and at the keyboard turns -0.8
position.SetY(0.0f); // further (OrientToAngle relative to that)
const auto rotation = self->GetRotation();
float right = 0.0f;
float forward = 0.0f;
auto playerRotation = rotation;
switch (GetInstrumentLot(self)) { switch (GetInstrumentLot(self)) {
case Bass: case Bass:
case Guitar: case Guitar:
position.SetX(position.GetX() + 5.0f); right = 5.0f;
break; break;
case Keyboard: case Keyboard:
position.SetX(position.GetX() - 0.45f); right = -0.45f;
position.SetZ(position.GetZ() + 0.75f); forward = 0.75f;
rotation = QuatUtils::AxisAngle(position, -0.8f); // Slight rotation to make the animation sensible playerRotation = rotation * QuatUtils::AxisAngle(NiPoint3Constant::UNIT_Y, -0.8f);
break; break;
case Drum: case Drum:
position.SetZ(position.GetZ() - 0.5f); forward = -0.5f;
break; 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) { InstrumentLot NsConcertInstrument::GetInstrumentLot(Entity* self) {