Scripting Helpers is winding down operations and is now read-only. More info→
Ad
Log in to vote
0

Auto adjust a camera to the size of a vehicle?

Asked by 10 years ago

Heyo, I've been attempting to make a nice lil' chase camera for vehicles n' such.

Here's what I have so far.

p = game.Players.LocalPlayer
repeat wait() until p.Character
c = p.Character
t = c.Torso
mouse = p:GetMouse()
UpDist = script.UpDist
BackDist = script.BackDist
local cc = Workspace.CurrentCamera
cc.CameraType = "Scriptable"
mouse.Move:connect(
function()
    --t.CFrame = CFrame.new(t.Position, Vector3.new(mouse.Hit.p.x, t.Position.y, mouse.Hit.p.z))
end
)

game:GetService("RunService").RenderStepped:connect(
function()
    if c.Humanoid.Sit then
        cc.CameraType = "Scriptable"
        --t.CFrame = CFrame.new(t.Position, Vector3.new(mouse.Hit.p.x, t.Position.y, mouse.Hit.p.z))
        cc:Interpolate((t.CFrame *CFrame.new(0, UpDist.Value, BackDist.Value)), t.CFrame, 0.25)--Hoping to find a way to find the size dimensions on the vehicle such as height and length
    elseif not c.Humanoid.Sit then
        cc.CameraType = "Custom"
    end
end)

Is there any way I can find the height and length of the vehicle and how would I identify the vehicle from the player sitting down.

Answer this question