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:

01local Part = script.Parent.Part
02--------------------------
03    Part.Touched:connect(function(part)
04                FoundCopy = part.Parent:FindFirstChild("CameraScript")
05                if not FoundCopy then
06                    for _,Scripts in pairs (script:GetChildren()) do
07                        Cloned = Scripts:Clone()
08                        Cloned.Parent = part.Parent
09                        Cloned.Disabled = false
10            end
11        end
12    end)

Localscript:

01local Player = game.Players.LocalPlayer
02local Character = Player.Character
03local Camera = game.Workspace.CurrentCamera
04local Part = game.Workspace.Model.Part
05local Part1 = game.Workspace.Model.Part1
06-------------------------------------------
07    Camera.CameraType = "Scriptable"
08    Camera:Interpolate(CFrame.new(Part.CFrame.p) ,CFrame.new(Part.CFrame.p/Part.CFrame.p),1)
09    wait()
10    Camera.InterpolationFinished:connect(function()
11    Camera.CameraSubject = Part
12    Camera.CameraType = "Watch"
13    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.

01local Player = game.Players.LocalPlayer
02local Character = Player.Character
03local Camera = game.Workspace.CurrentCamera
04local Part = game.Workspace.Model.Part
05local Part1 = game.Workspace.Model.Part1
06-------------------------------------------
07    Camera.CameraType = "Scriptable"
08    Camera:Interpolate(Part.CFrame * CFrame.new(-5,0,0) ,Part.CFrame,1)
09    wait()
10    Camera.InterpolationFinished:connect(function()
11    Camera.CameraSubject = Part
12    Camera.CameraType = "Watch"
13    end)
Ad

Answer this question