Make PTATCAM track spectator ROI instead of camera in ScenePlayer

This commit is contained in:
Christian Semmler 2026-04-03 21:24:27 -07:00
parent f7e2dd41ef
commit cecade7677
No known key found for this signature in database
GPG Key ID: 086DAA1360BEEE5C

View File

@ -421,8 +421,17 @@ void ScenePlayer::ApplyPtAtCam()
return;
}
LegoWorld* world = CurrentWorld();
if (!world || !world->GetCameraController()) {
// Find the spectator participant — PTATCAM tracks the spectator's position
// instead of the camera so the actor faces the same target for all players.
LegoROI* spectatorROI = nullptr;
for (const auto& p : m_participants) {
if (p.IsSpectator() && p.roi) {
spectatorROI = p.roi;
break;
}
}
if (!spectatorROI) {
return;
}
@ -444,7 +453,7 @@ void ScenePlayer::ApplyPtAtCam()
float upsqr = sqrt(up.LenSquared());
up = und;
up -= world->GetCameraController()->GetWorldLocation();
up -= spectatorROI->GetWorldPosition();
dir /= dirsqr;
pos.EqualsCross(dir, up);
pos.Unitize();