8 protected void TeleportPlayer()
13 ArmaReforgerScripted game =
GetGame();
17 WorkspaceWidget workspace = game.GetWorkspace();
21 BaseWorld world = game.GetWorld();
29 InputManager inputManager = game.GetInputManager();
33 float mouseX = inputManager.GetActionValue(
"MouseX");
34 float mouseY = inputManager.GetActionValue(
"MouseY");
37 vector startPos = workspace.ProjScreenToWorld(workspace.DPIUnscale(mouseX), workspace.DPIUnscale(mouseY), outDir, world, -1);
40 TraceParam trace =
new TraceParam();
41 trace.Start = startPos;
42 trace.End = startPos + outDir;
43 trace.Flags = TraceFlags.WORLD | TraceFlags.ENTS;
45 trace.Exclude = player;
47 if (startPos[1] > world.GetOceanBaseHeight())
48 trace.Flags = trace.Flags | TraceFlags.OCEAN;
50 float traceDis = world.TraceMove(trace,
null);
54 vector endPos = startPos + outDir * traceDis;
72 override bool EOnCameraInit()
74 GetInputManager().AddActionListener(
"ManualCameraTeleportPlayer", EActionTrigger.DOWN, TeleportPlayer);
79 override void EOnCameraExit()
81 GetInputManager().RemoveActionListener(
"ManualCameraTeleportPlayer", EActionTrigger.DOWN, TeleportPlayer);