Hey, I have a problem with rotating a welded model.
I’m generating a vehicle from JSON and then I weld each part of each model to VehicleBase which is vehicle’s PrimaryPart, like so:
for _, v in next, vehicle:GetDescendants() do
if (v:IsA('BasePart') and v.Name ~= 'VehicleBase') then
local weld = Instance.new('WeldConstraint')
weld.Part0 = vehicle.VehicleBase
weld.Part1 = v
weld.Parent = vehicle.VehicleBase
end
end
Then I insert body movers into VehicleBase so the vehicle can move.
Everything works fine but I ran into a problem when I tried to rotate one of the models in this vehicle.
Since the PrimaryPart of each model is constraint-welded to the VehicleBase, rotating one of the model’s PrimaryParts rotates the whole vehicle as well.
It looks like so: https://gyazo.com/a5e213f11f606558043bd907c3c0f611
I’ve looked for the solution but all the answers tell how to dynamically update C0 and C1 of all the welds so they don’t rotate but I can’t really do the same thing having hundrets of parts due to obvious performance issues it would cause.
I’ve also tried using Motor and Motor6D but it seems like the models are all in the same exact place when I use motors. Tried my best to fix it but I’m not really experienced with joints, welds etc. so I failed.
I’m pretty sure it isn’t hard to fix but I have no idea how to go about it. Could anyone help, please?
Ah my bad,
After a quick search on WeldConstraints, it says you can move them via .Position without updating the other parts. Perhaps you could convert your CFrame movement (assuming thats what you were doing originally) to Vectors.
The problem is that I can’t set the rotation using Position.
I tried with Orientation and it rotated but I would have to calculate the rotation and change the Orientation of each part each frame which would be extremely painful with hundrets of parts…