-3

i'm trying to do something like trigger in unity, with only cubes(not axis-aligned). So, I wanna algorithm, where I can get a Boolean with "intersected or not" :

public bool intersect(Vector3[] cube1,Vector3 cube2){ 
 if(not)
  return false;
 return true;
}

Thanks for your questions!

Backs
  • 24,430
  • 5
  • 58
  • 85
Akmal
  • 23
  • 3
  • See maybe [Non axis aligned bounding box collision and physics](http://gamedev.stackexchange.com/questions/20809/non-axis-aligned-bounding-box-collision-and-physics) or [How can I perform Collision Detection on rotated rectangles?](http://stackoverflow.com/questions/641219/how-can-i-perform-collision-detection-on-rotated-rectangles) – dbc Nov 21 '15 at 21:51

1 Answers1

1

You want to look up something called the seperating axis theorem

You end up with 15 axis tests (basically a dot product) between your 2 cubes.

Here's a little article on it.

Or a bigger pdf paper

I can't see any source with a quick search, but I bet it's out there. It's a very common test.