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
|
  |
| 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 |
|
|
|
| 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 |
|
|
|
| 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
|
  |
| Joined: 24 Jul 2014 |
| Total Posts: 789 |
|
|
| 17 Aug 2015 06:36 PM |
| @Above quit toxic posting. |
|
|
| Report Abuse |
|
|
|
| 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
|
  |
| 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 |
|
|