Update camera.lua
This commit is contained in:
parent
f6adf1f37d
commit
22a5b729e7
@ -25,7 +25,6 @@ function OnInit()
|
|||||||
local rotation = transform:GetRotation()
|
local rotation = transform:GetRotation()
|
||||||
currentRotation = rotation.y
|
currentRotation = rotation.y
|
||||||
|
|
||||||
-- Expose initial position and rotation for debugging or UI purposes
|
|
||||||
Engine.Expose("Position X", rotation.x)
|
Engine.Expose("Position X", rotation.x)
|
||||||
Engine.Expose("Position Y", rotation.y)
|
Engine.Expose("Position Y", rotation.y)
|
||||||
Engine.Expose("Rotation Y", currentRotation)
|
Engine.Expose("Rotation Y", currentRotation)
|
||||||
@ -84,9 +83,6 @@ function OnUpdate(deltaTime)
|
|||||||
local deltaX = 0
|
local deltaX = 0
|
||||||
local deltaZ = 0
|
local deltaZ = 0
|
||||||
|
|
||||||
-- Corrected Key-to-Direction Mapping:
|
|
||||||
-- W/S: Forward/Backward
|
|
||||||
-- A/D: Left/Right
|
|
||||||
if Engine.KeyDown(KeyCode.W) then
|
if Engine.KeyDown(KeyCode.W) then
|
||||||
-- Move forward
|
-- Move forward
|
||||||
deltaX = deltaX + forward.x * moveSpeed * deltaTime
|
deltaX = deltaX + forward.x * moveSpeed * deltaTime
|
||||||
@ -113,7 +109,7 @@ function OnUpdate(deltaTime)
|
|||||||
position.z = position.z + deltaZ
|
position.z = position.z + deltaZ
|
||||||
transform:SetPosition(position)
|
transform:SetPosition(position)
|
||||||
|
|
||||||
-- Expose updated position and rotation for debugging or UI purposes
|
-- Expose updated position and rotation
|
||||||
Engine.Expose("Position X", position.x)
|
Engine.Expose("Position X", position.x)
|
||||||
Engine.Expose("Position Y", position.y)
|
Engine.Expose("Position Y", position.y)
|
||||||
Engine.Expose("Rotation Y", currentRotation)
|
Engine.Expose("Rotation Y", currentRotation)
|
||||||
|
Loading…
Reference in New Issue
Block a user