Skip to content

Commit 9e2a2a7

Browse files
committed
Revert "fix: keep in mind camera might be moved by external script"
This reverts commit 8f37ae6.
1 parent a2f3206 commit 9e2a2a7

File tree

1 file changed

+10
-25
lines changed

1 file changed

+10
-25
lines changed

src/UI/Panels/FreeCamPanel.cs

Lines changed: 10 additions & 25 deletions
Original file line numberDiff line numberDiff line change
@@ -85,7 +85,6 @@ public FreeCamPanel(UIBase owner) : base(owner)
8585
public static GameObject followObject = null;
8686
public static Vector3 followObjectLastPosition = Vector3.zero;
8787
public static Quaternion followObjectLastRotation = Quaternion.identity;
88-
public static Vector3 lastKnownPosition = Vector3.zero;
8988

9089
public static GameObject lookAtObject = null;
9190

@@ -800,21 +799,13 @@ internal void Update()
800799
}
801800
Transform transform = FreeCamPanel.CameraContainer;
802801

803-
var inputDelta = Vector3.zero;
804802
if (!FreeCamPanel.blockFreecamMovementToggle.isOn && !FreeCamPanel.cameraPathMover.playingPath && FreeCamPanel.connector?.IsActive != true) {
805-
inputDelta = ProcessInput();
803+
ProcessInput();
806804
}
807805

808-
if (FreeCamPanel.followObject != null){
806+
if (FreeCamPanel.followObject != null){
809807
// position update
810-
var positionDelta = FreeCamPanel.followObject.transform.position - FreeCamPanel.followObjectLastPosition;
811-
812-
if (FreeCamPanel.lastKnownPosition != Vector3.zero)
813-
{
814-
//TODO: check delta
815-
positionDelta -= transform.position - (FreeCamPanel.lastKnownPosition + inputDelta);
816-
}
817-
transform.position += positionDelta;
808+
transform.position += FreeCamPanel.followObject.transform.position - FreeCamPanel.followObjectLastPosition;
818809

819810
if (FreeCamPanel.followRotationToggle.isOn){
820811
// rotation update
@@ -835,12 +826,10 @@ internal void Update()
835826
FreeCamPanel.connector?.ExecuteCameraCommand(transform);
836827

837828
FreeCamPanel.UpdatePositionInput();
838-
839-
FreeCamPanel.lastKnownPosition = FreeCamPanel.followObject ? transform.position : Vector3.zero;
840829
}
841830
}
842831

843-
internal Vector3 ProcessInput(){
832+
internal void ProcessInput(){
844833
FreeCamPanel.currentUserCameraPosition = transform.position;
845834
FreeCamPanel.currentUserCameraRotation = transform.rotation;
846835

@@ -853,26 +842,24 @@ internal Vector3 ProcessInput(){
853842
speedModifier = 0.1f;
854843

855844
moveSpeed *= speedModifier;
856-
857-
var delta = Vector3.zero;
858845

859846
if (IInputManager.GetKey(ConfigManager.Left_1.Value) || IInputManager.GetKey(ConfigManager.Left_2.Value))
860-
delta += transform.right * -1 * moveSpeed;
847+
transform.position += transform.right * -1 * moveSpeed;
861848

862849
if (IInputManager.GetKey(ConfigManager.Right_1.Value) || IInputManager.GetKey(ConfigManager.Right_2.Value))
863-
delta += transform.right * moveSpeed;
850+
transform.position += transform.right * moveSpeed;
864851

865852
if (IInputManager.GetKey(ConfigManager.Forwards_1.Value) || IInputManager.GetKey(ConfigManager.Forwards_2.Value))
866-
delta += transform.forward * moveSpeed;
853+
transform.position += transform.forward * moveSpeed;
867854

868855
if (IInputManager.GetKey(ConfigManager.Backwards_1.Value) || IInputManager.GetKey(ConfigManager.Backwards_2.Value))
869-
delta += transform.forward * -1 * moveSpeed;
856+
transform.position += transform.forward * -1 * moveSpeed;
870857

871858
if (IInputManager.GetKey(ConfigManager.Up.Value))
872-
delta += transform.up * moveSpeed;
859+
transform.position += transform.up * moveSpeed;
873860

874861
if (IInputManager.GetKey(ConfigManager.Down.Value))
875-
delta += transform.up * -1 * moveSpeed;
862+
transform.position += transform.up * -1 * moveSpeed;
876863

877864
if (IInputManager.GetKey(ConfigManager.Tilt_Left.Value))
878865
transform.Rotate(0, 0, moveSpeed * 10, Space.Self);
@@ -934,8 +921,6 @@ internal Vector3 ProcessInput(){
934921
}
935922

936923
FreeCamPanel.previousMousePosition = IInputManager.MousePosition;
937-
transform.position += delta;
938-
return delta;
939924
}
940925
}
941926

0 commit comments

Comments
 (0)