Posted By: CanadianDavid
EVENT_ENTITY with PhysX - 06/25/14 21:34
I notice that when I use the PhysX engine to move an object, the EVENT_ENTITY never triggers despite saying in the documentation that it also responds to "physics entity movement".
Consider the following code (download demo):When the ball collides with the player using c_move, the event is triggered and a beep is heard. When PhysX is used, the event is not triggered. How can I trigger an EVENT_ENTITY using PhysX?
Consider the following code (download demo):
Code:
#include <acknex.h> #include <ackphysx.h> function ball_event(){ beep(); } action ball(){ my.emask |= ENABLE_ENTITY; my.event = ball_event; pXent_settype (me, PH_RIGID, PH_SPHERE); // set the physics entity type pXent_setfriction (me,50); // set the friction on the ground pXent_setdamping (me,10,10); // set the damping pXent_setelasticity (me,50); // set the elasticity while(1){ //c_move(me,nullvector,vector(time_step,0,0),GLIDE); pXent_addforcecentral(me,vector(time_step,0,0)); wait(1); } } action hero(){ player = me; while(1){ vec_set(camera.x, my.x); camera.pan = my.pan; c_move(me,vector(key_w-key_s,key_a-key_d,0),nullvector,GLIDE); wait(1); } } void main() { physX_open(); level_load("level1.wmb"); }