I'm hoping someone has used coldet here.
I've replaced my Blitz3d collisions with Coldet. Collision detection works fine, however the collision normal on impact seem wrong.
Please try this, adapted from demo1
(Push the up arrow key to move the sphere into the box)
In a Blitz collision, the Z normal would be -1
Any ideas?
I've replaced my Blitz3d collisions with Coldet. Collision detection works fine, however the collision normal on impact seem wrong.
Please try this, adapted from demo1
(Push the up arrow key to move the sphere into the box)
;DEMO 1 ;Dymamic mesh to static mesh polygon to polygon collision. ;Include helper functions and needed globals Include "coldet.bb" Graphics3D 800,600,0,2 ;activate some global variables coldet_start() cam=CreateCamera() MoveEntity cam,0,3,-5 light=CreateLight() ;------------------------------ ;this will be the dynamic mesh ob1=CreateSphere() PositionEntity ob1,0,0,-3 ScaleEntity ob1, 0.5, 0.5, 0.5 EntityColor ob1,255,255,0 EntityAlpha ob1,.75 EntityFX ob1,16 ;this is the static mesh ob2=CreateCube() RotateEntity ob2,0,0,0 ScaleEntity ob2,1,1,1 EntityColor ob2,255,0,0 ;Make the coldet models and get their pointers ! ;Careful ! Do not use by mistake blitz's pointers. c_ob1 = coldet_make(ob1,1);1=dynamic c_ob2 = coldet_make(ob2,1);0=static ;------------------------------ PointEntity cam,ob2 While Not KeyHit(1) RenderWorld() ;Update your coldet's dynamic object matrix only when it moves or rotates If KeyDown(203) TranslateEntity ob1,-.02,0,0:coldet_setmatrix(ob1,c_ob1) If KeyDown(205) TranslateEntity ob1,.02,0,0:coldet_setmatrix(ob1,c_ob1) If KeyDown(200) TranslateEntity ob1,0,0,.2:coldet_setmatrix(ob1,c_ob1) If KeyDown(208) TranslateEntity ob1,0,0,-.2:coldet_setmatrix(ob1,c_ob1) If coldet_collision (c_ob1,c_ob2);if a collision occurs between model1 and model2 Text 10,10,"1" coldet_collision_point(c_ob1,0);get the collision point Text 10,20,"x: "+collision_point_x() Text 10,30,"y: "+collision_point_y() Text 10,40,"z: "+collision_point_z() Text 10,60,"tri1: "+coldet_colliding_tri(c_ob1,0);model1 colliding tri Text 10,70,"tri2: "+coldet_colliding_tri(c_ob1,1);model2 colliding tri coldet_colliding_verts(c_ob1,1,0);request collidong verts for model1 Text 10,90,"nx: "+colliding_nx1();and aquire the normals of the colliding tri Text 10,100,"ny: "+colliding_ny1() Text 10,110,"nz: "+colliding_nz1() EndIf Text 200,0,"Cursor keys move model1" Flip Wend ;FREE THE COLDET MODELS FROM MEMORY ! coldet_free_model(c_ob1) coldet_free_model(c_ob2) ;free global stuff coldet_end() End
In a Blitz collision, the Z normal would be -1
Any ideas?