#make parts connected to other part orbit eachother

1 messages · Page 1 of 1 (latest)

paper stratus
#

ok im explaining myself really badly but basically i want the whole model to rotate when i move the body part of this guy, i tried doing it and it works fine for symetrical objects but in this case it bugs

#

ill show a video ok

#

so the wand here looks out of place

#

`||~~***if not game:IsLoaded() then
game.Loaded:Wait()
end

task.wait(3)

local parts = {}

for i,v in pairs(workspace:GetDescendants()) do
if v:FindFirstChild("Weldedto") then
local martyr:Part = v.Weldedto.Value
local martyr_pos = martyr.Position
local vpos = v.Position
local vorient = v.Orientation
local martyr_orient = martyr.Orientation

    parts[#parts+1] = {v,martyr,vpos,martyr_pos,vorient,martyr_orient} -- the equivalent of table.insert
end

end

local start_rotating_event = script.Parent.StartRotating
start_rotating_event:Fire()

while task.wait() do

for i,v in pairs(parts) do
    local object = v[1]
    local martyr = v[2]
    local vpos = v[3]
    local martyr_pos = v[4]
    local vorient = v[5]
    local martyr_orient = v[6]
    
    local coeficient = vpos - martyr_pos
    local coeficient2 = (vorient - martyr_orient)
    object.Position = martyr.Position + coeficient
    object.Orientation = (martyr.Orientation + coeficient2)
end

end***~~||`

#

this is the whole script

#

i just want to know if 1. is there a premade solution in roblox already, and if not 2. how can i do this using math

#

also the parts are welded with a special object value