Refine FaceCam controls and status indicator
This commit is contained in:
1 parent
cd6d8445f2
commit
85946a3996
1 file changed
+15
-3
+15
-3
@@ -143,6 +143,9 @@ local function update_facecam(cam, settings)
|
|||||||
if scroll ~= 0 then distance = distance - scroll * 0.2 end
|
if scroll ~= 0 then distance = distance - scroll * 0.2 end
|
||||||
distance = math.max(0.5, math.min(5, distance))
|
distance = math.max(0.5, math.min(5, distance))
|
||||||
_G.__FC_FACE_DISTANCE = distance
|
_G.__FC_FACE_DISTANCE = distance
|
||||||
|
if scroll ~= 0 then
|
||||||
|
show_ui('<color=#00FF88><b>[FaceCam: ON]</b> Distance: ' .. string.format('%.1f', distance) .. '</color>')
|
||||||
|
end
|
||||||
local target = head.position
|
local target = head.position
|
||||||
local anchor = _G.__FC_FACE_ANCHOR
|
local anchor = _G.__FC_FACE_ANCHOR
|
||||||
if not anchor or anchor.transform.parent ~= head then
|
if not anchor or anchor.transform.parent ~= head then
|
||||||
@@ -322,6 +325,7 @@ function _G.__FREECAM_TICK()
|
|||||||
show_ui("<color=#00FF88><b>[FreeCam: ON]</b> Speed: " .. string.format("%.1f", _G.__FREECAM_SPEED) .. " | Arrows: Fly | PgUp/PgDn: Up/Down | RMB: Look</color>")
|
show_ui("<color=#00FF88><b>[FreeCam: ON]</b> Speed: " .. string.format("%.1f", _G.__FREECAM_SPEED) .. " | Arrows: Fly | PgUp/PgDn: Up/Down | RMB: Look</color>")
|
||||||
end
|
end
|
||||||
else
|
else
|
||||||
|
local settings = _G.__GAC_CAMERA_SETTINGS or {mode="freecam"}
|
||||||
if cam then
|
if cam then
|
||||||
set_cinemachine_enabled(cam, true)
|
set_cinemachine_enabled(cam, true)
|
||||||
end
|
end
|
||||||
@@ -329,12 +333,13 @@ function _G.__FREECAM_TICK()
|
|||||||
_G.__FC_FACE_ENTITY = nil
|
_G.__FC_FACE_ENTITY = nil
|
||||||
_G.__FC_FACE_DISTANCE, _G.__FC_FACE_LOCAL_FORWARD = nil, nil
|
_G.__FC_FACE_DISTANCE, _G.__FC_FACE_LOCAL_FORWARD = nil, nil
|
||||||
if _G.__FC_FACE_ANCHOR then CS.UnityEngine.Object.Destroy(_G.__FC_FACE_ANCHOR); _G.__FC_FACE_ANCHOR = nil end
|
if _G.__FC_FACE_ANCHOR then CS.UnityEngine.Object.Destroy(_G.__FC_FACE_ANCHOR); _G.__FC_FACE_ANCHOR = nil end
|
||||||
show_ui(rainbow_watermark(Time.unscaledTime or 0))
|
local label = settings.mode == 'facecam' and 'FaceCam' or 'FreeCam'
|
||||||
|
show_ui('<color=#00FF88><b>[' .. label .. ': OFF]</b></color>')
|
||||||
end
|
end
|
||||||
end
|
end
|
||||||
|
|
||||||
local now = Time.unscaledTime or 0
|
local now = Time.unscaledTime or 0
|
||||||
if not _G.__FREECAM_ENABLED or now >= (_G.__FC_STATUS_UNTIL or 0) then
|
if now >= (_G.__FC_STATUS_UNTIL or 0) then
|
||||||
if now >= (_G.__FC_WATERMARK_NEXT or 0) then
|
if now >= (_G.__FC_WATERMARK_NEXT or 0) then
|
||||||
_G.__FC_WATERMARK_NEXT = now + 0.05
|
_G.__FC_WATERMARK_NEXT = now + 0.05
|
||||||
show_ui(rainbow_watermark(now))
|
show_ui(rainbow_watermark(now))
|
||||||
@@ -387,9 +392,11 @@ function _G.__FREECAM_TICK()
|
|||||||
|
|
||||||
-- Raw Unity mouse input remains available to the camera while
|
-- Raw Unity mouse input remains available to the camera while
|
||||||
-- InControl battle clicks are gated separately below.
|
-- InControl battle clicks are gated separately below.
|
||||||
|
local cameraAdjusted = false
|
||||||
if Input.GetMouseButton(1) then
|
if Input.GetMouseButton(1) then
|
||||||
local rotX = Input.GetAxis("Mouse X") or 0
|
local rotX = Input.GetAxis("Mouse X") or 0
|
||||||
local rotY = Input.GetAxis("Mouse Y") or 0
|
local rotY = Input.GetAxis("Mouse Y") or 0
|
||||||
|
cameraAdjusted = rotX ~= 0 or rotY ~= 0
|
||||||
_G.__FC_EULER = Vector3(_G.__FC_EULER.x - rotY * 2.5,
|
_G.__FC_EULER = Vector3(_G.__FC_EULER.x - rotY * 2.5,
|
||||||
_G.__FC_EULER.y + rotX * 2.5, 0)
|
_G.__FC_EULER.y + rotX * 2.5, 0)
|
||||||
end
|
end
|
||||||
@@ -426,6 +433,11 @@ function _G.__FREECAM_TICK()
|
|||||||
|
|
||||||
if move.sqrMagnitude > 0.0001 then
|
if move.sqrMagnitude > 0.0001 then
|
||||||
_G.__FC_POS = _G.__FC_POS + move.normalized * (_G.__FREECAM_SPEED * dt)
|
_G.__FC_POS = _G.__FC_POS + move.normalized * (_G.__FREECAM_SPEED * dt)
|
||||||
|
cameraAdjusted = true
|
||||||
|
end
|
||||||
|
if cameraAdjusted and now >= (_G.__FC_INDICATOR_NEXT or 0) then
|
||||||
|
_G.__FC_INDICATOR_NEXT = now + 0.1
|
||||||
|
show_ui('<color=#00FF88><b>[FreeCam: ON]</b> Speed: ' .. string.format('%.1f', _G.__FREECAM_SPEED) .. '</color>')
|
||||||
end
|
end
|
||||||
|
|
||||||
-- Enforce locked free camera transform EVERY frame
|
-- Enforce locked free camera transform EVERY frame
|
||||||
@@ -452,7 +464,7 @@ if not _G.__FREECAM_REGISTERED then
|
|||||||
pcall(function() CS.UnityEngine.Application.onBeforeRender = CS.UnityEngine.Application.onBeforeRender + function() _G.__FREECAM_TICK() end end)
|
pcall(function() CS.UnityEngine.Application.onBeforeRender = CS.UnityEngine.Application.onBeforeRender + function() _G.__FREECAM_TICK() end end)
|
||||||
end
|
end
|
||||||
|
|
||||||
if not _G.__FREECAM_ENABLED then
|
if not _G.__FREECAM_ENABLED and (Time.unscaledTime or 0) >= (_G.__FC_STATUS_UNTIL or 0) then
|
||||||
show_ui(rainbow_watermark(Time.unscaledTime or 0))
|
show_ui(rainbow_watermark(Time.unscaledTime or 0))
|
||||||
end
|
end
|
||||||
|
|
||||||
|
|||||||
Reference in new issue
Block a user