Hey developers!
Today I tried to make rotating viewport frame.I made this script, but it says in output (GetBoundingBox() is not valid member of “that viewportframe”
please help, thanks
local ViewPortCamera = Instance.new("Camera", script)
ViewPortCamera.CameraType = Enum.CameraType.Scriptable
local y = .8
local x = 4
local R = 0
local audi = workspace:WaitForChild("TestCar")
local ViewPortPoint = Vector3.new(0,0,0)
local ViewPortFrame = script.Parent:WaitForChild("CarImage")
ViewPortFrame.LightDirection = Vector3.new(0,1,0)
ViewPortFrame.Ambient = Color3.fromRGB(255,255,255)
ViewPortFrame.CurrentCamera = ViewPortCamera
audi:SetPrimaryPartCFrame(CFrame.new(ViewPortPoint))
audi = ViewPortFrame
game:GetService("RunService").RenderStepped:Connect(function()
local ofrane, size = audi:GetBoundingBox()
local Max = math.max(size.X,size.Y,size.Z)
local Distance = (Max/math.tan(math.rad(ViewPortCamera.FieldOfView))) * x
local CurrentDistance = (Max/2) + Distance
ViewPortCamera.CFrame = CFrame.Angles(0,math.rad(R),0) * CFrame.new(ViewPortPoint + Vector3.new(0,0,CurrentDistance),ViewPortFrame)
R = R +1
end)