Quick Question, Easiest way to check collision?
by Michael Bacon · in Torque Game Engine · 11/13/2007 (6:58 am) · 2 replies
I have a box, a start point and an end point. What is the easiest way that I can check to see if this box collides with anything in the world?
Thanks!
Thanks!
#2
I'm looking for the proper way to implement swept box collisions. I believe I need to use the BoxConvex class but I'm not sure how to start.
11/19/2007 (3:54 am)
That solution won't work for colliding against small objects and allows penetration of points and corners which will not be acceptable for a camera.I'm looking for the proper way to implement swept box collisions. I believe I need to use the BoxConvex class but I'm not sure how to start.
Torque Owner Henry Todd
Atomic Walrus
To cast a ray parallel to the line, you'll just be doing a cast from (startPos+cornerOffset) to (startPos+cornerOffset+lineVector), where lineVector is the vector describing the path from start to end (literally endPos - startPos) and cornerOffset is the vector from startPos to the corner's position. Finally, an excuse to use some ASCII art!
If the box isn't aligned with the line, you'll need to basically figure out what its max extents are on the plane perpendicular to the line. Repeat the first procedure, using those extents as the corners.