Fix orbit camera mirroring by matching gameplay handedness
This commit is contained in:
1 parent
1b679c641a
commit
d8f1b51c86
10 files changed
+125
-4
No files matched your search
@@ -1231,11 +1231,11 @@ internal static class Program
|
||||
if (keys.Contains(45) || keys.Contains(86)) radius *= MathF.Exp(dt);
|
||||
}
|
||||
radius = Math.Max(radius, 0.01f);
|
||||
var eye = target + radius * new Vector3(MathF.Cos(elevation) * MathF.Sin(angle),
|
||||
MathF.Sin(elevation), MathF.Cos(elevation) * MathF.Cos(angle));
|
||||
var orbit = OrbitCamera.Create(target,radius,angle,elevation,(float)renderer.Width / renderer.Height);
|
||||
var eye = orbit.Eye;
|
||||
var view = originalCamera
|
||||
? Matrix4x4.CreateLookAtLeftHanded(originalStart!.CameraPosition, originalStart.Position + new Vector3(0, 80, 0), Vector3.UnitY)
|
||||
: Matrix4x4.CreateLookAt(eye, target, Vector3.UnitY);
|
||||
: orbit.View;
|
||||
var renderEye = originalCamera ? originalStart!.CameraPosition : eye;
|
||||
var renderTarget = originalCamera ? originalStart!.Position + new Vector3(0,80,0) : target;
|
||||
if (simulation != null && !inspecting)
|
||||
@@ -1318,7 +1318,7 @@ internal static class Program
|
||||
viewportWidth: renderer.Width, viewportHeight: renderer.Height);
|
||||
var projection = gameplayProjection
|
||||
? SceneProjection.CreateGameplay(level?.Code, (float)renderer.Width / renderer.Height)
|
||||
: Matrix4x4.CreatePerspectiveFieldOfView(MathF.PI / 3, (float)renderer.Width / renderer.Height, Math.Max(radius / 10000, 0.01f), radius * 20);
|
||||
: orbit.Projection;
|
||||
projection.M22 *= -1;
|
||||
if (animations != null)
|
||||
{
|
||||
|
||||
Reference in new issue
Block a user