#define ADDITIONAL_SHAPE
#include <acknex.h>
#include <ackphysX.h>
void collision_event()
{
if (event_type == EVENT_FRICTION)
{
var time_=0;
while(time_<2)
{
draw_text("collision detected",5,5,vector(0,0,255));
time_+=time_step/16;
wait(1);
}
}
}
void main()
{
level_load(NULL);
physX_open();
ENTITY* ent1=ent_create(CUBE_MDL,vector(100,0,0),NULL);
pXent_settype(ent1,PH_RIGID,PH_BOX);
pXent_setbodyflag(ent1,NX_BF_FROZEN_POS_X,1);
pXent_setbodyflag(ent1,NX_BF_FROZEN_POS_Z,1);
pXent_setbodyflag(ent1,NX_BF_FROZEN_ROT,1);
#ifdef ADDITIONAL_SHAPE
ENTITY* ent1_shape=ent_create(CUBE_MDL,vector(100,16,0),NULL);
pXent_addshape(ent1,ent1_shape,PH_BOX);
#endif
ENTITY* ent2=ent_create(CUBE_MDL,vector(100,40,0),NULL);
pXent_settype(ent2,PH_STATIC,PH_POLY);
pXent_setcollisionflag(ent1,ent2,NX_NOTIFY_ON_START_TOUCH);
ent1.event=collision_event;
while(1)
{
pXent_addvelcentral (ent1,vector(0,(key_a-key_d)*time_step*4,0));
#ifdef ADDITIONAL_SHAPE
ent1_shape.y=ent1.y+16;
#endif
wait(1);
}
}