fix(world): match retail portal passage and exit warp
This commit is contained in:
parent
eab23cbdd1
commit
842bd89c16
11 changed files with 355 additions and 28 deletions
|
|
@ -247,6 +247,32 @@ public sealed class RetailChaseCamera : ICamera
|
|||
PlayerTranslucency = ComputeTranslucency(d);
|
||||
}
|
||||
|
||||
/// <summary>
|
||||
/// Retail <c>SmartBox::set_viewer(playerPosition, reset_sought: 1)</c>
|
||||
/// (<c>0x00452C40</c>), called by
|
||||
/// <c>SmartBox::PlayerPositionUpdated</c> after a teleport
|
||||
/// (<c>0x00453870</c>). Both the published viewer and its sought
|
||||
/// position restart at the player; subsequent camera updates then
|
||||
/// re-extend the boom through the ordinary damped/swept path.
|
||||
/// </summary>
|
||||
public void ResetViewerToPlayer(Vector3 playerPosition, float playerYaw)
|
||||
{
|
||||
Vector3 playerForward = new(MathF.Cos(playerYaw), MathF.Sin(playerYaw), 0f);
|
||||
|
||||
_publishedEye = playerPosition;
|
||||
_soughtEye = playerPosition;
|
||||
_dampedForward = playerForward;
|
||||
_initialised = true;
|
||||
|
||||
Position = playerPosition;
|
||||
ViewerCellId = 0u; // retail set_viewer clears viewer_cell at the teleport boundary
|
||||
View = Matrix4x4.CreateLookAt(
|
||||
playerPosition,
|
||||
playerPosition + playerForward,
|
||||
Vector3.UnitZ);
|
||||
PlayerTranslucency = 0f;
|
||||
}
|
||||
|
||||
/// <summary>
|
||||
/// Adjust the camera distance (zoom) by a delta, clamped to
|
||||
/// <see cref="DistanceMin"/>..<see cref="DistanceMax"/>. Mirrors
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue