Ok so first thing I first.
I’ve been tried scripting an orbiting camera around a part.
What I’m struggling with?
- I’m struggling with camera’s rotation.
This is a first video with following codes
“I was added math.rad(addedDegrees) in CFrame.Angles”
local RunService = game:GetService("RunService")
local camera = workspace.CurrentCamera
local addedDegrees = 0
RunService.RenderStepped:Connect(function(dT)
local getPlot_CFrame:CFrame = workspace.SpawnLocation.CFrame
local height,radius = 10,20
addedDegrees += 1
--camera.CameraType = "Scriptable"
local designatedCamera_CFrame:CFrame = getPlot_CFrame * CFrame.new(radius*math.sin(math.rad(addedDegrees)),height,radius*math.cos(math.rad(addedDegrees))) * CFrame.Angles(math.rad(360)-math.atan2(height,radius),math.rad(addedDegrees),0)
local lerping:CFrame = workspace.Part.CFrame:Lerp(designatedCamera_CFrame,0.2778)
workspace.Part.CFrame = lerping
--camera.CFrame = lerping
end)
–Sorry for bad optimizing code–
What I want:
I want my part align parallel to the ground but keep focusing.