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

How do I move a part relative to another part?

Asked by 6 years ago

This may be easy but I can't understand the math in my head and I'm not sure how to explain it but...

What I'm trying to do is make a model-moving tool. I've created the basics of the tool but without the math needed, every part just moves to the same position in a big mess instead of keeping the original shape of the structure.

I'm wondering If anyone can help me figure out the math needed to make a model move relatively to the primary part. The parts wanting to be moved are not grouped and cannot be grouped, so I'm trying to find a way to make each part move separately to where they were relative to the primary part.

I've tried a few CFraming methods but the results are just the same, either it fails or I end up getting stuck, wondering what to do next. And, also tried to find some tools that I could study, nothing helped though. Does anyone know any methods on how I would do this?

0
Interesting question, I have been struggling with this same issue aswell. Hoping somebody replies. Le_Teapots 913 — 6y
0
You keep saying "model-moving tool" or "make a model move" but then say the parts are not grouped. idk wym. clarify: you want to recreate SetPrimaryPartCFrame with ungrouped parts? I could answer that. cabbler 1942 — 6y
0
I didn't word it correctly. I honestly just said that so people wouldn't ignore the "I want to move each part separately" part. Witchest 48 — 6y

1 answer

Log in to vote
0
Answered by 6 years ago

I think i understand your question. if this answer is irrelivent tell me and i will try cand make one more relevent

So to move a model the way you want you can use the :MoveTo() command The MoveTo() command moves the models primary part to the Vector3 position inside the arguements. so if you drag the models primary part you can set its position by inserting the Mouse.p into the arguements.

so the code could look something like this

Model = (Model You want to be moved)
Mouse = (Players Mouse)

While MousePressed == true do

    if Mouse.Target.Parent == Model then

        Model.PrimaryPart = Mouse.Target
        wait(0.1)

        While MousePressed == true do

            Model:MoveTo(mouse.p)

        end

    else

        print("NotGrabbingModel")

    end

end

this might work i havent tested it yet but it should.

0
As I said, I want the parts to move separately so this won't work. As in each one gets cframed separately. Witchest 48 — 6y
Ad

Answer this question