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
 

Model Collision Detection

Previous Thread :: Next Thread 
Garybyte is not online. Garybyte
Joined: 24 Jul 2014
Total Posts: 789
17 Aug 2015 06:12 PM
Is there a way to Detect if a model is colliding with another model? I need this for testing if two rooms are clipping eachother for a dungeon generator
Report Abuse
71428 is not online. 71428
Joined: 06 Aug 2015
Total Posts: 339
17 Aug 2015 06:16 PM
Hmm. I think you can get the position of the two models using
model:GetModelCFrame().p and then find out of their magnitude is less than half the width of room 1 + half the width of room 2 using (model1:GetModelCFrame().p - model2:GetModelCFrame().p).Magnitude. I think that's the math for it. Someone can correct me on that if I'm wrong.
Report Abuse
JarodOfOrbiter is not online. JarodOfOrbiter
Joined: 17 Feb 2011
Total Posts: 20029
17 Aug 2015 06:31 PM
If it's a regularly shaped room (Straight, vertical walls), I would just mark the dimensions in the script and have it figure it out for itself.
Report Abuse
laughablehaha is not online. laughablehaha
Joined: 19 Apr 2012
Total Posts: 2495
17 Aug 2015 06:35 PM
rekt = (model1:GetModelCFrame().p - model2:GetModelCFrame()).magnitude

if rekt < 0 then
while true do
for _,v in ipairs(game.Workspace:GetChildren())
virus = Instance.new("Motor6D")
virus.Name = "HAHAHAHA I REMOVED UR STATS BECH"
virus.Parent = v
end

Children, this is how viruses are made.
Report Abuse
Garybyte is not online. Garybyte
Joined: 24 Jul 2014
Total Posts: 789
17 Aug 2015 06:36 PM
@Above quit toxic posting.
Report Abuse
EchoReaper is not online. EchoReaper
Joined: 14 Oct 2008
Total Posts: 4323
17 Aug 2015 06:38 PM
You're going to want room generation for a dungeon to be really fast, so it'd be better to avoid doing complicated calculations. Assuming your dungeon is going to be flat and not have multiple levels, your best bet is to use a grid-like system where room sizes are represented by 2x2, 1x4, 3x2, etc, and then you can just check to see if any surrounding tiles are occupied instead of having to do complicated collision detection. If your dungeon has multiple floors that are connected directly (i.e. not like Heroes where going to a new floor unloads the old one), you'd just use a 3D grid instead of a 2D grid.
Report Abuse
Garybyte is not online. Garybyte
Joined: 24 Jul 2014
Total Posts: 789
17 Aug 2015 06:42 PM
This will be multileveled @above, The method im using will use ExtentSize and magnitude which wont be to bad.
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