Collision Box

So with 1.7 we got a new collision solid - a box… could someone elaborate a bit on that?

How expensive are they (in comparation with a sphere and 6 polygons, is it a AABB or OBB)?

What test can I perform with them ( box into sphere? ray into box? box into box?).

When sholud I use them?

What’s the egg syntax for them if I want to add them to an egg model?

Hi,

The documentation for box colliders would be shortly included in the manual. meanwhile hope this helps.

A box represents a cuboid. It consists of three pairs of rectangles, with adjacent sides meeting each other at a right angle. This can be employed where ever a necessity arises for using six intersecting planes. A box can be both a ‘from’ and ‘into’ object for the shapes specified in the chart.
A box can only be constructed as an Axis-Aligned Bounding Box (AABB). That is, each side of the box is parallel to one of the coordinate axes. Once constructed, all collision tests are performed on the box as though it was an Oriented-Bounding Box (OBB).

There are two constructors for the Box. One of them specifies the center for the box as well as the distance of each of the sides from the center.

box = CollisionBox(cx,cy,cz,dx,dy,dz)

box = CollisionBox(center,dx,dy,dz)
The second form of constructor takes the two diagonally opposite end points of the AABB.

box = CollisionBox(Point3(minx,miny,minz),Point3(maxx,maxy,maxz))

The following combinations have been implemented for the box colliders:

Sphere->Box
Box->Sphere
Ray->Box

Box was implemented more for convenience of programming than performance, although it is equal or better in performance to using 6-polygons. you can use it any place where you will need 6-polygons in the shape of a box.
Box->Sphere is two times better in terms of FPS as compared to 6-Polygons->Sphere. for the other two cases, box performs better that 6-polygons, but only is marginally better. considering the programatic convenience i would go for box in those cases too.

i will get back to you regarding the egging syntax.

I’ve been playing around with the collision boxes and I’m getting a weird behavior. I’m using the “CollisionHandlerPusher”, and sometimes when an object touches a box, it gets translated very far from the box all of a sudden.

I’m getting fine behavior if I use only spheres. Is there anything I’ve to be having in mind while using boxes?

I will look into it and let you know about whats happening with respect to the boxes…

Ok. Thanks a lot. I am really looking forward to the collision boxes, since they simplify my code a lot :slight_smile:

will box-> plane collision be introduced too?