mirror of
https://github.com/isledecomp/isle-portable.git
synced 2026-05-02 02:23:56 +00:00
Make PTATCAM track spectator ROI instead of camera in ScenePlayer
This commit is contained in:
parent
f7e2dd41ef
commit
cecade7677
@ -421,8 +421,17 @@ void ScenePlayer::ApplyPtAtCam()
|
|||||||
return;
|
return;
|
||||||
}
|
}
|
||||||
|
|
||||||
LegoWorld* world = CurrentWorld();
|
// Find the spectator participant — PTATCAM tracks the spectator's position
|
||||||
if (!world || !world->GetCameraController()) {
|
// 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;
|
return;
|
||||||
}
|
}
|
||||||
|
|
||||||
@ -444,7 +453,7 @@ void ScenePlayer::ApplyPtAtCam()
|
|||||||
float upsqr = sqrt(up.LenSquared());
|
float upsqr = sqrt(up.LenSquared());
|
||||||
|
|
||||||
up = und;
|
up = und;
|
||||||
up -= world->GetCameraController()->GetWorldLocation();
|
up -= spectatorROI->GetWorldPosition();
|
||||||
dir /= dirsqr;
|
dir /= dirsqr;
|
||||||
pos.EqualsCross(dir, up);
|
pos.EqualsCross(dir, up);
|
||||||
pos.Unitize();
|
pos.Unitize();
|
||||||
|
|||||||
Loading…
Reference in New Issue
Block a user