Need help with CFrame for a Sinking Ship Game

Hi everyone. I recently decided to make a Sinking Ship game. I need help with CFrame. Can someone tell me how to rotate the ship of 60° (Image 1) and 90° (Image 2) In 15 Minuts ?
Image 1:


Image 2:

Thanks in advance.
Xoxo: official_DevFrancais.

You could use TweenService to interpolate the rotation of the ship’s CFrame. Take a look at these links for more help: UnderstandingCFrame and TweenService.

What you could do is add an orientation of 60 degrees or 90 degrees when an event passes using CFrame.Angles(). For example you could do something like:

local part = game.Workspace.Part --finds the part in the workspace
local newCFrame = CFrame.Angles(math.rad(60), 0, 0) --the angle applied to it, in this case around the x axis.
 
part.CFrame = newCFrame -- Sets the CFrame of the part to the assigned value in newCFrame

Then you could do whatever you need to make the event fire under a certain condition. If you want it to move slowly throughout a period of time then you should research lerping. Hope this helps :smile:

That’s good but do you know how to make a CFrame script and choose a time (Move block to 0,0,0 to 7,8,9 In 1 Minut for example)

Use either your own interpolation code, or use CFrame:Lerp() to achieve the effects you want. Simply put in the desired CFrame (which in your case would be a CFrame.Angles(math.rad(90),0,(math.rad(60)), and use a for loop to interpolate at any degree you want.

1 Like

Idk if this would work but you could use TweenService to make it look smoother.

local Part = workspace:FindFirstChild("PartName")

local TimeItGetsToSink = 60

local TweenService = game:GetService("TweenService")
local TweenInf = TweenInfo.new(TimeItGetsToSink, Enum.EasingStyle.Linear, Enum.EasingDirection.InOut, 0, false, 0) -- Change this as you want
local Goal = {CFrame = Part.CFrame * CFrame.angles(math.rad(60), 0, 0)}
local Tween = TweenService:Create(Part, TweenInf, Goal)
Tween:Play()