generic image
Processing...
  • Games
  • Catalog
  • Develop
  • Robux
  • Search in Players
  • Search in Games
  • Search in Catalog
  • Search in Groups
  • Search in Library
  • Log In
  • Sign Up
  • Games
  • Catalog
  • Develop
  • Robux
   
ROBLOX Forum » Game Creation and Development » Scripters
Home Search
 

Check if two parts are touching without them moving?

Previous Thread :: Next Thread 
Jakeup10 is not online. 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
JarodOfOrbiter is not online. JarodOfOrbiter
Joined: 17 Feb 2011
Total Posts: 20029
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
JimmyChance is not online. JimmyChance
Joined: 01 Nov 2009
Total Posts: 3681
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 is not online. micke3212
Joined: 24 Nov 2009
Total Posts: 3000
21 Apr 2015 11:08 PM
Region3?
Report Abuse
DevVince is not online. DevVince
Joined: 08 Nov 2008
Total Posts: 9245
21 Apr 2015 11:12 PM
Magnitude?
Report Abuse
SuperiorEternal is not online. SuperiorEternal
Joined: 22 Aug 2009
Total Posts: 2365
21 Apr 2015 11:13 PM
It's just a Vector3 equation as used for gui collision.
Report Abuse
SuperiorEternal is not online. SuperiorEternal
Joined: 22 Aug 2009
Total Posts: 2365
21 Apr 2015 11:13 PM
Although, the gui collision was just for two coordinates.
Report Abuse
2NQ is not online. 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
Previous Thread :: Next Thread 
Page 1 of 1
 
 
ROBLOX Forum » Game Creation and Development » Scripters
   
 
   
  • About Us
  • Jobs
  • Blog
  • Parents
  • Help
  • Terms
  • Privacy

©2017 Roblox Corporation. Roblox, the Roblox logo, Robux, Bloxy, and Powering Imagination are among our registered and unregistered trademarks in the U.S. and other countries.



Progress
Starting Roblox...
Connecting to Players...
R R

Roblox is now loading. Get ready to play!

R R

You're moments away from getting into the game!

Click here for help

Check Remember my choice and click Launch Application in the dialog box above to join games faster in the future!

Gameplay sponsored by:
Loading 0% - Starting game...
Get more with Builders Club! Join Builders Club
Choose Your Avatar
I have an account
generic image