Cube collision

BlitzMax Forums/MiniB3D Module/Cube collision

Hezkore(Posted 2011) [#1]
Life would be so much easier if MiniB3D had cube collision instead of only ellipsoid collision!
Is there anyone out there with some code that could help me? :/


AdamRedwoods(Posted 2011) [#2]
So I take it that EntityBox command does not work in miniB3D? The code seems to be all there for triangle intersection testing.
http://blitzmax.com/b3ddocs/command.php?name=EntityBox&ref=3d_cat


Hezkore(Posted 2011) [#3]
All the collision methods are ellipsoid though.
http://www.blitzbasic.com/b3ddocs/command.php?name=Collisions
I need box-to-polygon collision.


Warner(Posted 2011) [#4]
Maybe you could look into using a physics library? Most have cube-based collisions. The minib3d extended version has a physics library included.


Hezkore(Posted 2011) [#5]
But the Extended version is old and unfinished/canceled and last time I tried it, it had pretty bad performance and the physics part was in poor condition. :/


AdamRedwoods(Posted 2011) [#6]
under the miniB3D there is a file: misc.cpp
and in this file, there is code for segment-to-triangle intersection testing.

So my thought would be to:
- perform the ellipsoid intersection
- then break that down by getting the triangle closest to the collision by way of CollisionTriangle()
- get other entity's triangle by way of EntityCollided() and CollisionTriangle()
- then you have your triangle, and you can test the other triangle's 3 segments using C_IntersectSegmentTriangle()


This approach I think would work for most meshes, not just boxes.

PS:
You would also have to add the function to the extern in minib3d.bmx:
Function C_IntersectSegmentTriangle:Int( px:float , py:float, pz:float, qx:float, qy:float, qz:float, ax:float, ay:float, az:float, ..
 bx:float, by:float, bz:float, cx:float, cy:float, cz:float, u:float ptr, v:float ptr, w:float ptr, t:float ptr)


Last edited 2011

Last edited 2011

Last edited 2011


Warner(Posted 2011) [#7]
But the Extended version is old and unfinished/canceled and last time I tried it, it had pretty bad performance and the physics part was in poor condition. :/
Oh? How is the physics engine in bad shape? I isolated it from minib3d for usage in my own engine, and so far I found no problems while testing it.
So my thought would be to:
- perform the ellipsoid intersection
I believe that in minib3d, it is possible to set the Collisions command to 'no response', as opposed to blitz3d.

Last edited 2011