Posted By: sebbi91
[PhysX] whole physik is disabling, maybe a bug? - 01/13/11 19:21
Hi comunity
I've another problem with PhysiX.
I have several Models in my Level.
The most of them are Objects with a Physik like this in my player1 action:
here is a code snippet :
I've 2 player-models that uses the "PH_CHAR" function.
All works fine if the player is alive.
But if the Player get killed the physik is stop working.
I want to swith the phyics-mode from my player from"PH_CHAR" to "PH_RIGID"
I read in the manual about that and so I used something like this:
Here is a short code snippet of my script.
If the player is dead and if I write the "pxent_settype(player1,NULL,NULL);" part
The whole Physik in the leel is stopping working!
For exampel The other Models with "PH_CHAR" cant move anymore.
I hope someone know how to fix it.
best regards
sebbi
I've another problem with PhysiX.
I have several Models in my Level.
The most of them are Objects with a Physik like this in my player1 action:
Code:
if(my.health<=0) { pXent_settype(my,NULL,NULL); wait(1); pXent_settype(my,PH_RIGID,PH_CAPSULE); }
here is a code snippet :
Code:
action physxtest() { pXent_settype (my,PH_RIGID,PH_BOX); // set the physics entity type pXent_setfriction (my,20); // set the friction on the ground pXent_setdamping (my,50,50); // set the damping pXent_setelasticity (my,100); // set the elasticity }
I've 2 player-models that uses the "PH_CHAR" function.
All works fine if the player is alive.
But if the Player get killed the physik is stop working.
I want to swith the phyics-mode from my player from"PH_CHAR" to "PH_RIGID"
I read in the manual about that and so I used something like this:
Code:
if(my.health<=0) { pXent_settype(my,NULL,NULL); wait(1); pXent_settype(my,PH_RIGID,PH_CAPSULE); }
Here is a short code snippet of my script.
Code:
void main() { ENTITY* temp; ENTITY* map; var terrain_chunk = 0; video_mode = 11; video_depth =32; video_screen=2; sound_vol = 100; time_smooth =0.8 ; max_particles = 50000; max_entities = 2000; fps_max = 30; fps_min = 20; fps_lock = 0; // time_step is now always 16/60 = 0.266 ticks #endif tex_share = 1; // map entities share their textures enable_polycollision = 2; //d3d_autotransparency=1; //1st pixel is the overlay pixel //d3d_near_models = 0.4; d3d_antialias = 4; preload_mode=0; shadow_stencil = 0; shadow_lod = 2; physX_open(); pX_setccd (1); pX_setunit(0.10); //0.7 pX_setgravity(vector(0,0,-9.81)); level_load(""); reset(camera,SHOW|AUDIBLE); camera1.clip_near = 1; camera1.clip_far = 1000;//if smaler it contains more camera2.clip_near = 1; camera2.clip_far = 1000;//if smaler it contains more //Manage Level-creating // map=ent_create("testarea_n.hmp",NULL,terrain_act); set(map,SHADOW||OVERLAY|POLYGON); .... } action player1_act() { player1=me; my.material=steel_mat; set(my,POLYGON|CAST); my.emask|=ENABLE_SHOOT|ENABLE_BLOCK|ENABLE_IMPACT|ENABLE_ENTITY|ENABLE_SCAN; // my.push=100; my.group = 3; //+1 by player2 my.health=100; my.ammo_small=300; my.ammo_rocket=50; my.ammo_heavy=20; my.team=p1; my.alpha=100; my.push=100; // pX_setautodisable ( 8, 8 ); pXent_settype(me,PH_CHAR,PH_BOX); pXent_setmass (my, 3); // and its mass pXent_setfriction (my, 500); // set the friction pXent_setdamping (my, 40, 40); // set the damping pXent_setelasticity (my, 50); // set the elasticity wait(1); while(1) { if(my.health>0) { VECTOR* mov = vector(0,0,0); if(key_cuu)mov.x=*time_step; if(key_cud) mov.x=-7*time_step; if(key_cuu==1&&key_cud==1){mov.x=0;} if(key_home) mov.y= 7*time_step; if(key_pgup) mov.y=-7*time_step; if(key_home==1&&key_pgup==1){mov.y=0;} ground_distanz=-100; c_trace(my.x,ground_distanz,IGNORE_YOU|IGNORE_MODELS|IGNORE_PASSABLE|IGNORE_PUSH|USE_POLYGON); if(ground_distanz>0) { push_force_z =1* time_step; //calculate an fall down } else { push_force_z=-15 * time_step; mov.z=push_force_z*time_step; vec_rotate(mov,player1.pan); pXent_movechar(me,mov,player1.pan,0); //Thats the movement script ..... } //now the player get killed else { pXent_settype(player1,NULL,NULL); wait(1); pXent_settype(player1,PH_RIGID,PH_CAPSULE); } }
If the player is dead and if I write the "pxent_settype(player1,NULL,NULL);" part
The whole Physik in the leel is stopping working!
For exampel The other Models with "PH_CHAR" cant move anymore.
I hope someone know how to fix it.
best regards
sebbi