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

Help with CFrame?

Asked by 10 years ago

I made a script that interplolates the Player's camera to a brick's position,but it goes inside the brick I want it to go outside of brick,how can I do this?

What I mean when it goes inside and how I want it to be.

Script that inserts a local script into a character:

local Part = script.Parent.Part
--------------------------
    Part.Touched:connect(function(part)
                FoundCopy = part.Parent:FindFirstChild("CameraScript")
                if not FoundCopy then
                    for _,Scripts in pairs (script:GetChildren()) do
                        Cloned = Scripts:Clone()
                        Cloned.Parent = part.Parent
                        Cloned.Disabled = false
            end
        end
    end)

Localscript:

local Player = game.Players.LocalPlayer
local Character = Player.Character
local Camera = game.Workspace.CurrentCamera
local Part = game.Workspace.Model.Part
local Part1 = game.Workspace.Model.Part1
-------------------------------------------
    Camera.CameraType = "Scriptable"
    Camera:Interpolate(CFrame.new(Part.CFrame.p) ,CFrame.new(Part.CFrame.p/Part.CFrame.p),1)
    wait()
    Camera.InterpolationFinished:connect(function()
    Camera.CameraSubject = Part
    Camera.CameraType = "Watch"
    end)


1 answer

Log in to vote
1
Answered by
acecateer 130
10 years ago

1. You don't need to get the Vector3 of a CFrame when using Camera interpolation

2. You can offset the CFrame of it. I showed an example by doing an offset of -5 on the X axis.

local Player = game.Players.LocalPlayer
local Character = Player.Character
local Camera = game.Workspace.CurrentCamera
local Part = game.Workspace.Model.Part
local Part1 = game.Workspace.Model.Part1
-------------------------------------------
    Camera.CameraType = "Scriptable"
    Camera:Interpolate(Part.CFrame * CFrame.new(-5,0,0) ,Part.CFrame,1)
    wait()
    Camera.InterpolationFinished:connect(function()
    Camera.CameraSubject = Part
    Camera.CameraType = "Watch"
    end)
Ad

Answer this question