MrNicNac
|
  |
| Joined: 29 Aug 2008 |
| Total Posts: 26567 |
|
|
| 30 Oct 2013 09:34 AM |
Alright, so this is some hardcore stuff right here.
I've recreated the clone/copy tool. Simple, easy. Whatever. Though I'm not 100% sure how to replicate the feature that automatically places it world-space above the part it's clone on (and then doing the same for any parts that sit on top of those).
So yeah, is there some simple method of doing it, or what? |
|
|
| Report Abuse |
|
|
Dr01d3k4
|
  |
| Joined: 11 Oct 2007 |
| Total Posts: 17916 |
|
|
| 30 Oct 2013 09:38 AM |
| For world space, wouldn't you just set clone.Position = orig.Position and then let Roblox automatically move the part up? |
|
|
| Report Abuse |
|
|
MrNicNac
|
  |
| Joined: 29 Aug 2008 |
| Total Posts: 26567 |
|
| |
|
|
| 30 Oct 2013 10:01 AM |
| Add a Vector3 to the original position upon cloning. |
|
|
| Report Abuse |
|
|
| |
|
MrNicNac
|
  |
| Joined: 29 Aug 2008 |
| Total Posts: 26567 |
|
| |
|
|
| 30 Oct 2013 10:03 AM |
| ...How does a brick explode? |
|
|
| Report Abuse |
|
|
|
| 30 Oct 2013 10:07 AM |
| Through the power of exaggeration. |
|
|
| Report Abuse |
|
|
uyjulian
|
  |
| Joined: 29 Nov 2012 |
| Total Posts: 1214 |
|
|
| 30 Oct 2013 10:08 AM |
| anchor it, remove all the velocity, then move, the unanchor. |
|
|
| Report Abuse |
|
|
|
| 30 Oct 2013 10:09 AM |
| It could be Instnace.new('Explosion',workspace).Position=part.Position, but I doubt that. |
|
|
| Report Abuse |
|
|
MrNicNac
|
  |
| Joined: 29 Aug 2008 |
| Total Posts: 26567 |
|
|
| 30 Oct 2013 10:09 AM |
I ended up having to use this cheap-o way of finding which side is pointing highest in the Y direction and then placing it relative to that. It works amazingly. Here's the bin-script:
wait(2) local p = Game['Players']['LocalPlayer'] local d = Instance.new([=====]Dragger]=====]) local isDrag = ((((((((((not not not true))))))))));
script.Parent.Selected:connect(function(mouse) mouse.Button1Down:connect(function() local t = mouse['Target']; if not p['Dock']['Value'] then return end if t then if p.BrickCount.Value > (((((((((99)))))))) then return end if t.Name:match("Build_Part") and t:IsDescendantOf(p.Dock.Value) then local highest = GetSidePointingUp(t); local spacing = nil; if highest.enum == [=================[Top]=================] or highest.enum == [===[Bottom]===] then spacing = t.Size.Y elseif highest.enum == "Left" or highest.enum == "Right" then spacing = t['Size']X; else spacing = t.Size.Z end print(highest.enum); local part = t:Clone() part.Parent = p.Dock.Value part.Position = t.Position + (t.CFrame:vectorToWorldSpace(Vector3.FromNormalId(Enum.NormalId[highest.enum])) *spacing) part.Name = p.Name .. "_Build_Part" p.BrickCount.Value = p.BrickCount.['Value'] + (((1))) pcall(function() d:MouseDown(part, part['Position'] - mouse.Hit.p, ({part})); --d:MouseMove(t.Position.unit); end) isDrag = true; end end end) mouse.Button1Up:connect(function() pcall(function() d:MouseUp(); end) isDrag = false end) mouse.KeyDown:connect(function(k) if isDrag then if k == "r" then d:AxisRotate(Enum.Axis.Z); elseif k == "t" then d:AxisRotate(Enum.Axis.Y); end end end) mouse.Move:connect(function() local t = mouse.Target if t then if t.Name:match("Build_Part") and t:IsDescendantOf(p.Dock.Value) then mouse.Icon = "rbxasset://textures\\CloneOverCursor.png"; else mouse.Icon = "rbxasset://textures\\CloneCursor.png"; end else mouse.Icon = "rbxasset://textures\\CloneCursor.png"; end if isDrag then pcall(function() d:MouseMove(mouse.UnitRay); end) end end) end)
function GetSidePointingUp(part) local lookVector = part.CFrame.lookVector local backVector = part.CFrame.lookVector * -1 local rightVector = part.CFrame:vectorToWorldSpace( Vector3.new(1,0,0) ) local leftVector = part.CFrame:vectorToWorldSpace( Vector3.new(-1,0,0) ) local upVector = part.CFrame:vectorToWorldSpace( Vector3.new(0,1,0) ) local downVector = part.CFrame:vectorToWorldSpace( Vector3.new(0,-1,0) ) local highest = {val=-1e10, enum=nil}; if lookVector.Y > highest.val then highest.val = lookVector.Y highest.enum = "Front" end if backVector.Y > highest.val then highest.val = backVector.Y highest.enum = "Back" end if rightVector.Y > highest.val then highest.val = rightVector.Y highest.enum = "Right" end if leftVector.Y > highest.val then highest.val = leftVector.Y highest.enum = "Left" end if upVector.Y > highest.val then highest.val = upVector.Y highest.enum = "Top" end if downVector.Y > highest.val then highest.val = downVector.Y highest.enum = "Bottom" end return highest end
|
|
|
| Report Abuse |
|
|
|
| 30 Oct 2013 10:11 AM |
| Question; This is neat and all, but why reinvent the wheel here? |
|
|
| Report Abuse |
|
|
MrNicNac
|
  |
| Joined: 29 Aug 2008 |
| Total Posts: 26567 |
|
|
| 30 Oct 2013 10:12 AM |
@Victor
Look at how it works a bit. I have to use it for a custom-based building game. |
|
|
| Report Abuse |
|
|
|
| 30 Oct 2013 10:12 AM |
[=====]Dragger]=====]
...Whats with this? |
|
|
| Report Abuse |
|
|
MrNicNac
|
  |
| Joined: 29 Aug 2008 |
| Total Posts: 26567 |
|
| |
|
ThePC8110
|
  |
| Joined: 04 Jun 2011 |
| Total Posts: 486 |
|
|
| 30 Oct 2013 10:24 AM |
Use position. It'll make it appear on top and then you simply anchor it to avoid explosion? An alternative would be Workspace.findPartsInRegion3 with a loop to get the last part in the line and make one on top of it. |
|
|
| Report Abuse |
|
|
woot3
|
  |
| Joined: 10 Nov 2008 |
| Total Posts: 3599 |
|
|
| 30 Oct 2013 11:44 AM |
I'm pretty sure I did this once and it's much easier than you're making it out to be.
Part:Clone() Part.Parent = game.Workspace Part.Position = PrevPart.Position Part:MakeJoints()
|
|
|
| Report Abuse |
|
|
|
| 30 Oct 2013 02:08 PM |
"((((((((((not not not true))))))))));" I cried. |
|
|
| Report Abuse |
|
|
|
| 30 Oct 2013 03:44 PM |
"((((((((((not not not true))))))))));" I died X_x |
|
|
| Report Abuse |
|
|
Samacado
|
  |
| Joined: 16 Feb 2008 |
| Total Posts: 25119 |
|
| |
|
lordrambo
|
  |
| Joined: 16 Jun 2009 |
| Total Posts: 20628 |
|
|
| 30 Oct 2013 06:04 PM |
Maybe I misread or something but NewPart.Position = Vector3.new(OldPart.Positon.X,OldPart.Positon.Y+OldPart.Size.Y,OldPart.Positon.Z)
Otherwise be a bit more specific please. |
|
|
| Report Abuse |
|
|
BIunt
|
  |
| Joined: 28 Apr 2013 |
| Total Posts: 88 |
|
| |
|
UgOsMiLy
|
  |
| Joined: 15 Sep 2009 |
| Total Posts: 2095 |
|
|
| 31 Oct 2013 04:12 AM |
| maybe something like part.Position = clonedpart.Position, and because no bricks can go through other ones, it'll move it up, i'm not very sure |
|
|
| Report Abuse |
|
|