Jakeup10
|
  |
| Joined: 29 Nov 2008 |
| Total Posts: 6782 |
|
|
| 21 Apr 2015 10:36 PM |
| Just a simple question. Say there's three parts in space, all anchored. Is it possible to check if those parts are touching, or not? |
|
|
| Report Abuse |
|
|
|
| 21 Apr 2015 10:39 PM |
| The best way is probably to do math and see via math if any of the bounding boxes overlap. |
|
|
| Report Abuse |
|
|
|
| 21 Apr 2015 11:06 PM |
| If they are axis-aligned it would be pretty simple. But if not, it's pretty complex. |
|
|
| Report Abuse |
|
|
micke3212
|
  |
| Joined: 24 Nov 2009 |
| Total Posts: 3000 |
|
| |
|
DevVince
|
  |
| Joined: 08 Nov 2008 |
| Total Posts: 9245 |
|
| |
|
|
| 21 Apr 2015 11:13 PM |
| It's just a Vector3 equation as used for gui collision. |
|
|
| Report Abuse |
|
|
|
| 21 Apr 2015 11:13 PM |
| Although, the gui collision was just for two coordinates. |
|
|
| Report Abuse |
|
|
2NQ
|
  |
| Joined: 18 Apr 2015 |
| Total Posts: 81 |
|
|
| 21 Apr 2015 11:46 PM |
function seeIfCollision(main,other) local function BuildRegion(part) local centroid = part.Position; local offset = part.Size; local build_item = {x = offset.X / 2, y = offset.Y / 2, z = offset.Z / 2}; local build_top = {}; local build_bot = {}; for x,y in next,build_item do table.insert(build_top,y + centroid[x]); table.insert(build_bot,y - centroid[x]); end local top = Vector3.new(unpack(build_top)); local bot = Vector3.new(unpack(build_bot)); return Region3.new(bot,top); end
local a = BuildRegion(main); for x,y in next,workspace:FindPartsInRegion3(a) do if(y == other) then return true end end end |
|
|
| Report Abuse |
|
|