|
2 registered members (Quad, TipmyPip),
8,132
guests, and 1
spider. |
|
Key:
Admin,
Global Mod,
Mod
|
|
|
PhysX collision event and add shape
#436899
02/05/14 10:06
02/05/14 10:06
|
Joined: Aug 2002
Posts: 3,258 Mainz
oliver2s
OP
Expert
|
OP
Expert
Joined: Aug 2002
Posts: 3,258
Mainz
|
I don't know if this is 3DGS related oder PhysX related: If I set collision flags and event ( http://www.conitec.net/beta/pXent_setcollisionflag.htm) the event is only triggered if the physX ent collides with its initialized body. If I add some more shapes with "pXent_addshape" the collision event is not triggered if the new added shapes collide with something.
|
|
|
Re: PhysX collision event and add shape
[Re: jcl]
#436999
02/07/14 12:21
02/07/14 12:21
|
Joined: Aug 2002
Posts: 3,258 Mainz
oliver2s
OP
Expert
|
OP
Expert
Joined: Aug 2002
Posts: 3,258
Mainz
|
|
|
|
Re: PhysX collision event and add shape
[Re: oliver2s]
#437543
02/19/14 10:07
02/19/14 10:07
|
Joined: Aug 2002
Posts: 3,258 Mainz
oliver2s
OP
Expert
|
OP
Expert
Joined: Aug 2002
Posts: 3,258
Mainz
|
I don't know if this is 3DGS related oder PhysX related: If I set collision flags and event ( http://www.conitec.net/beta/pXent_setcollisionflag.htm) the event is only triggered if the physX ent collides with its initialized body. If I add some more shapes with "pXent_addshape" the collision event is not triggered if the new added shapes collide with something. Here I made a small test script where you can clearly see the problem. In the first line I made a #define for testing purpose, which adds a physX shape via pXent_addshape (no collision triggered). If the #define is commented out, no additional shape will be added (collision is triggered). The physX test object can be move with A and D keys.
#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);
}
}
|
|
|
|