Scripting Helpers is winding down operations and is now read-only. More info→
Ad
Log in to vote
0

How come setting the CFrame of my model is breaking it apart?

Asked by 6 years ago
Edited 6 years ago
local RunService = game:GetService("RunService")
local player = game.Players.LocalPlayer
local sinWaveNum = 0

RunService.Heartbeat:connect(function()

    sinWaveNum = sinWaveNum + .01

    Boats[player.Name]:SetPrimaryPartCFrame(Boats[player.Name].Center.CFrame*
    CFrame.new(.025,0,0)):toWorldSpace(CFrame.new(0,0,0))*
    CFrame.Angles(math.cos(sinWaveNum)/800,0,-math.cos(sinWaveNum)/1000)

end)

Keep this in mind: all of the parts in the 'boat' are anchored and are welded to 1 center piece in the boat model that's also anchored.

I'm trying to make my boat move upon heartbeat but my sinWave function when applied slowly yet surely makes the boat 'crack'. All boat parts stay together, but it just slowly splits apart for some reason. Any ideas on how to fix this?

And if you're wondering, this is how I welded all parts to my boat's center:

local function Weld(p1, p2) --p1 = center piece, p2 = boat part
    local w = Instance.new("Weld", p1)
    w.Part0 = p1
    w.Part1 = p2
    w.C1 = p2.CFrame:toObjectSpace(p1.CFrame)
end
0
If SetPrimaryPartCFrame is your only form of movement, can't the parts just be anchored and not welded? I'm pretty sure the "cracking" only happens when welded. mattscy 3725 — 6y
0
nah it still happens thehybrid576 294 — 6y
0
Your model mustn't be anchored for your welds to work. LifeInDevelopment 364 — 6y
0
but is there any way to do it while it's anchored, i dont want the loose physics for the boat to bounce around thehybrid576 294 — 6y

2 answers

Log in to vote
0
Answered by 6 years ago

From what I know, it looks like you didn't weld your boat. It's kinda like when you sit down on the boat it welds the Character to the seat.

Basically you would need to weld every part together, I suggest using a loop. If your lazy there is a welding script called qPerfectionWeld which welds everything together.

Basically weld it.

Hopefully this helped

0
i welded it as said, but i just didnt put it in because i didnt put in the part where the boat is created because there is too much code thehybrid576 294 — 6y
Ad
Log in to vote
0
Answered by
TheePBHST 154
6 years ago

Okay, welding. You can weld with the constraints too. But, in ROBLOX, welding is typically gluing un-anchored parts together. But, when you move any parts that has a weld, it breaks because its position has changed. So, you're gonna need to re-weld it, or anchor it and weld.

0
You can also make it as a group, set its PrimaryPart and change the CFrame of that PrimaryPart TheePBHST 154 — 6y

Answer this question