so, im trying to make a camera similar to AoT games like this:
--Services
local userInputService = game:GetService("UserInputService")
local runService = game:GetService("RunService")
local TweenService = game:GetService("TweenService")
--Player & Character
local plr = game:GetService("Players").LocalPlayer
local Character = plr.Character or plr.CharacterAdded:Wait()
local hum = Character:WaitForChild("Humanoid")
local hrp = Character:WaitForChild("HumanoidRootPart")
--Other
local Camera = game:GetService("Workspace").CurrentCamera
function Update()
TweenService:Create(hum, TweenInfo.new(0.5, Enum.EasingStyle.Linear, Enum.EasingDirection.Out), {CameraOffset = (hum.MoveDirection) * 2}):Play()
if hum.MoveDirection.Magnitude <= 0 then
TweenService:Create(hum, TweenInfo.new(0.5, Enum.EasingStyle.Linear, Enum.EasingDirection.Out), {CameraOffset = (Vector3.new(0,0,0))}):Play()
end
end
runService.RenderStepped:Connect(Update)
I made it like this, but the problem is that hum.MoveDirection is relative to the world causing this effect:
walking to west:
walking to east:
can someone help me?