|
| 02 Apr 2015 09:27 PM |
| If I have two parts, at two different rotations and two different sizes, how would I check if any area of the first part is within the second? Basically, how would I check if the two parts touch each other at any place (like if a corner from the first part protrudes into the second, how would I make a function that returns true)? |
|
|
| Report Abuse |
|
|
| |
|
|
| 02 Apr 2015 09:30 PM |
Now this one is fun, because most people would do "point checking" which is easy, but won't tell you if any part of each part is colliding. The best way I've ever been presented has been a matrix box-collision algorithm by Axis Angles:
http://hastebin.com/zidawuzuli.lua |
|
|
| Report Abuse |
|
|
|
| 02 Apr 2015 09:37 PM |
| Do you think Roblox uses something like this for Region3s (I mean, I would guess not, but I could be wrong)? The :FindPartsInRegion3() method of workspace will get parts that have some cross-section with the region, so I was wondering. |
|
|
| Report Abuse |
|
|
amanda
|
  |
| Joined: 21 Nov 2006 |
| Total Posts: 5925 |
|
|
| 02 Apr 2015 09:52 PM |
@DrMathematica
*goes to link* *starts to read comments* 'Don't even try to read it' *tries to read it* internal monologue: 'Hey, this isn't that bad..' *scrolls down* |
|
|
| Report Abuse |
|
|
|
| 02 Apr 2015 09:53 PM |
You know, I would honestly go out and say they use a 2-step 2D collision method. Where they measure the 2D intersection on the XY axis, and then the YZ axis.
For instance, imagine visualizing them from two sides of the Region3. You can test one side, and if it's inside the Region3, then move on to the next side to find out if it really is inside of it. |
|
|
| Report Abuse |
|
|
amanda
|
  |
| Joined: 21 Nov 2006 |
| Total Posts: 5925 |
|
|
| 02 Apr 2015 09:58 PM |
| Also, I've done that before, with a similar setup, but about 5 billion times less intricate, so mine isn't effective at all for that purpose, but I wasn't using it to detect intersections I was using it as a tool to build maps and buildings by script, with each part having key points mapped out so I can do clean positioning and rotation around any of these points without having to guess and check. |
|
|
| Report Abuse |
|
|
| |
|