|
| 16 Dec 2013 06:37 PM |
| wanna move a model through some parts :3 |
|
|
| Report Abuse |
|
|
|
| 16 Dec 2013 06:41 PM |
Basically i was wondering if there is a way to do essentially the same thing as moveto() but using cframe so it can appear inside other parts, go through parts, ect.
if there isnt could i just save the vector3 relative to the position of the other parts? |
|
|
| Report Abuse |
|
|
| |
|
Nyxis
|
  |
| Joined: 15 Nov 2012 |
| Total Posts: 3374 |
|
| |
|
|
| 16 Dec 2013 07:43 PM |
| I'm trying to move a model using a script. i can move it into another part ect easily with roblox studio. was wondering what i have to do to move a model asif i was using cframe, where the model will go exactly where i say regardless of parts there. |
|
|
| Report Abuse |
|
|
| |
|
|
| 16 Dec 2013 09:03 PM |
Oh. i figured it out. It doesnt work with rotated parts, and you need a part named Base in it, but it works for my needs. for those curious, here ya go:
function movemodel(model,pos) local r = 0 local list = {} c = model:GetChildren() for i = 1,#c do if c[i].ClassName == "Part" and c[i].Name ~= "Base" then r = r + 1 list[r] = c[i] r = r + 1 list[r] = c[i].Position - model.Base.Position end
end model.Base.CFrame = CFrame.new(pos.X,pos.Y,pos.Z) for i = 1,#c do if c[i].Name ~= "Base" and c[i].ClassName == "Part" then for m = 1,#list do if list[m] == c[i] then print(c[i].Name) c[i].CFrame = model.Base.CFrame * CFrame.new(list[m+1].X,list[m+1].Y,list[m+1].Z) end end end end end |
|
|
| Report Abuse |
|
|
HAXO
|
  |
| Joined: 19 Mar 2010 |
| Total Posts: 690 |
|
|
| 16 Dec 2013 09:06 PM |
Too much code. I can't read all that.
1) Make sure all the parts are anchored. 2) Set the model's parent to nil. 3) Move the model. 4) Set the model's parent to Workspace |
|
|
| Report Abuse |
|
|