Advertisement
Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- table.insert(cameraEvents, conUp)
- table.insert(cameraEvents, conDown)
- table.insert(cameraEvents, conChange)
- local start = os.clock()
- local update = function()
- if inBuild then
- local delta = os.clock() - start
- if rotateFlat ~= 0 then
- rotation = rotation + delta * flatRotSpeed * rotateFlat
- end
- if zoomFlat ~= 0 then
- setZoom(zoom - delta * flatZoomSpeed * zoomFlat)
- end
- local x, z = camPos.x, camPos.z
- local curMoveDelta = movementDelta
- local viewportSize = camera.ViewportSize
- if mousePos.X <= mouseZoneOffset then
- curMoveDelta = Vector2.new((mouseZoneOffset - mousePos.X) / mouseZoneOffset, curMoveDelta.Y)
- else
- if viewportSize.X - mouseZoneOffset <= mousePos.X then
- curMoveDelta = Vector2.new(-(mousePos.X - (viewportSize.X - mouseZoneOffset)) / mouseZoneOffset, curMoveDelta.Y)
- end
- end
- if mousePos.Y <= mouseZoneOffset - mouseHeightOffset then
- curMoveDelta = Vector2.new(curMoveDelta.X, (mouseZoneOffset - mouseHeightOffset - mousePos.Y) / mouseZoneOffset)
- else
- if viewportSize.Y - mouseZoneOffset - mouseHeightOffset <= mousePos.Y then
- curMoveDelta = Vector2.new(curMoveDelta.X, -(mousePos.Y - (viewportSize.Y - mouseZoneOffset - mouseHeightOffset)) / mouseZoneOffset)
- end
- end
- x = x + clamp(curMoveDelta.X, -1, 1) * delta * moveSpeed * math.sin(rotation + math.pi / 2)
- z = z + clamp(curMoveDelta.X, -1, 1) * delta * moveSpeed * math.cos(rotation + math.pi / 2)
- x = x + clamp(curMoveDelta.Y, -1, 1) * delta * moveSpeed * math.sin(rotation)
- z = z + clamp(curMoveDelta.Y, -1, 1) * delta * moveSpeed * math.cos(rotation)
- warn(moveSpeed)
- camPos = Vector3.new(clamp(x, -75, 75), camPos.y, clamp(z, -75, 75))
- camera.CoordinateFrame = module:GetBuildPos(plot)
- start = os.clock()
- end
- end
- do
- runService:BindToRenderStep("CameraMovement", Enum.RenderPriority.Camera.Value, update)
- end
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement