I would like to use this feature in my new game but have little to no clue on how to replicate it:
Basically, how do I replicate it?
If anyone can provide some example code or a link to a tutorial, it would be appreciated!
I would like to use this feature in my new game but have little to no clue on how to replicate it:
Basically, how do I replicate it?
If anyone can provide some example code or a link to a tutorial, it would be appreciated!
All they did was tween the camera’s position. I don’t think a tutorial is needed either, you just have to experiment with it, I’ll still give you one though: https://www.youtube.com/watch?v=mwDoGQvphHA
You could use TweenService to make the camera move smoothly and you could detect when the player attempts to scroll past the beginning rock then tween it down to face the bottom rock. You could also set nodes to face the rocks.
I had some free time so I made it myself:
Code:
--//Services
local TweenService = game:GetService("TweenService")
--//Variables
local CurrentCamera = workspace.CurrentCamera
local Rocks = workspace:WaitForChild("Rocks")
local ScreenGui = script.Parent
local RocksButton = ScreenGui.RocksButton
local Left = ScreenGui.Left
local Right = ScreenGui.Right
local Index = ScreenGui.Index
--//Controls
local rockIndex = 1
local menuEnabled = false
--//Functions
local function OnRockChanged()
Index.Text = rockIndex
local rock = Rocks:WaitForChild(rockIndex)
local movementTween = TweenService:Create(CurrentCamera, TweenInfo.new(1, Enum.EasingStyle.Quint), {
CFrame = CFrame.lookAt(rock.Position + rock.CFrame.LookVector * 6 + Vector3.yAxis, rock.Position)
})
movementTween:Play()
end
RocksButton.MouseButton1Down:Connect(function()
menuEnabled = not menuEnabled
Left.Visible = menuEnabled
Right.Visible = menuEnabled
Index.Visible = menuEnabled
CurrentCamera.CameraType = menuEnabled and Enum.CameraType.Scriptable or Enum.CameraType.Custom
if menuEnabled then
OnRockChanged()
end
end)
Left.MouseButton1Down:Connect(function()
rockIndex -= 1
if rockIndex < 1 then
rockIndex = #Rocks:GetChildren()
end
OnRockChanged()
end)
Right.MouseButton1Down:Connect(function()
rockIndex += 1
if rockIndex > #Rocks:GetChildren() then
rockIndex = 1
end
OnRockChanged()
end)
Rocks is a folder of the rocks, RocksButton is used to open the menu, Left is used as the left arrow, Right is used as the right arrow, and Index displays which rock you are on.
This topic was automatically closed 14 days after the last reply. New replies are no longer allowed.