Advertisement
Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- local a,b,c = workspace.A, workspace.B, workspace.C
- local distanceFactor = 1 -- decimal = smaller distance away, whole numbers > 1 = more distance away
- -- a,b are outer walls. c is the camera block
- -- For use in an actual game, just find out which two players are closest to the edge of the map.
- -- Replace a and b with their positions.
- while wait() do
- local aPos,bPos,cPos = a.Position, b.Position, c.Position -- If you do what the above comments suggest, remove .Position from a and b
- local connectionLine = (bPos - aPos)
- local distance = connectionLine.magnitude
- local midPoint = aPos:lerp(bPos, 1/2)
- local perpendicularLine = Vector3.new(connectionLine.Z, 0, -connectionLine.X).unit
- c.Position = midPoint + (perpendicularLine*distance*distanceFactor)
- end
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement