So for my game I was planning on making a Delivery Truck/Boat that would move. However, I don’t know how I would do that as it would be an entire model. Look at this picture for example:
Pretty sure he’s more wanting to have a model interpolate smoothly in a certain path. Premade, I assume, in a smooth manner where CFrame interpolation (:Lerp section) and Bézier Curves comes in the picture.
What I would do for the actual moving an entire model part of the question here though. Would be that I’d weld everything to one main part in the model, then CFrame that main part only, so the other parts welded to it would naturally follow.
You would need to first get a list of points that make up the line so it follows the curve that you want. Then you simply tween the model to each point in the list using tween service or whatever other method you want
@ZurichBT I tried your method out with a simple truck I made but then when I played the tween the truck starting to rotate 90º.
local TweenService = game:GetService("TweenService")
local Panel = workspace.Truck
local PanelRoot = Panel.PrimaryPart
wait(2)
local PanelSlideInfo = TweenInfo.new(5,Enum.EasingStyle.Quad,Enum.EasingDirection.Out,0,false,0) -- Let's use all defaults here
local PanelSlideTween = TweenService:Create(PanelRoot, PanelSlideInfo, {
CFrame = workspace.Waypoint.CFrame,
})
PanelSlideTween:Play()
I put this code in the command bar like the tutorial said:
local Panel = workspace.Truck
-- Using Panel.PrimaryPart for convenience's sake
local Part1 = Panel.PrimaryPart
for _, Part0 in pairs(Panel:GetChildren()) do
if Part0:IsA("BasePart") and not (Part0 == Part1) then
local WeldConstraint = Instance.new("WeldConstraint")
WeldConstraint.Part0 = Part0
WeldConstraint.Part1 = Part1
WeldConstraint.Parent = WeldConstraint.Part0
Part0.Anchored = false
end
end
Part1.Anchored = true
Part1.CanCollide = false
Uhh, I wouldn’t use the command bar to weld things. I personally really enjoy this welding plugin. It’s really easy, and it’ll explain how it works by hovering over the buttons.
Your truck will always try to match your waypoint’s CFrame exactly, which could be why it’s rotating. Try making it just match the waypoint’s position:
local TweenService = game:GetService("TweenService")
local Panel = workspace.Truck
local PanelRoot = Panel.PrimaryPart
wait(2)
local PanelSlideInfo = TweenInfo.new(5,Enum.EasingStyle.Quad,Enum.EasingDirection.Out,0,false,0) -- Let's use all defaults here
local PanelSlideTween = TweenService:Create(PanelRoot, PanelSlideInfo, {
CFrame = CFrame.new(workspace.Waypoint.CFrame.p) --Notice we're using the position of the CFrame and not just the whole CFrame!
})
PanelSlideTween:Play()