bounding box for a triangle...
Hi all,
I'm working on a game and i'm having the same problems as everyone else...
I need a bounding box around my triangle but now its a square it needs to be a triangle.
anyone any idea's?
now it is like the left one, i needs to be like the right one.
thanks
Comments
You can get an accurate triangle collision by overlapping several rectangles and triggering a collision only when all are touched (i.e. the overlapped area is touched but not the excluded areas). Getting a non-equilateral triangle is trickier but still possible.
Of course, if you want an equilateral triangle you can just rotate a square and use a corner.
Surely you'd only need three ?
Or you could make 100 1x1 pixel actors spaced evenly to form one single triangle
Example file.
Link: https://www.mediafire.com/?kbtez6qcdj0tlxy
Three is several :P I was thinking of a different method to you, though.
Yep, I suppose it is ! For some reason I also think of several as more than a few but less than a lot.
It's got too much of the word 'seven' in it for my liking.
thanks! @socks i did it a bit different but still the same result!
No problem.
With the method above in my demo you can set it up so that one actor spawns the three edge actors, so you just have to drag a single triangle actor into your scene wherever you like and the sides are automatically generated for you . . . this would be useful if you had to drag lots of triangles into a scene.