[PhysX] whole physik is disabling, maybe a bug?

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:

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
Posted By: sebbi91

Re: [PhysX] whole physik is disabling, maybe a bug? - 01/19/11 19:18

hello ?
Posted By: xxxxxxx

Re: [PhysX] whole physik is disabling, maybe a bug? - 01/20/11 16:09

Hi,
maby you shoult use
pXent_settype(player1,0,0);

EDIT: you can use pXent_kinematic and pXent_moveglobal.
I get the not same problem when i use your code, not all physik
ents become disabled.

PS: Sorry for my English!
Posted By: sebbi91

Re: [PhysX] whole physik is disabling, maybe a bug? - 01/20/11 18:15

no problem I am a german user ^^
I have a bad English too.

I cant get it working!
If i write it so my player is hovering in the air.
Please could you give me a scipt excample?

i tried it in that way:

Code:
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;
....

while(1)
{
					
if(my.health>0)
{
pXent_kinematic(my, 0); // kinematic object (Disable kinematic)
....

//movement

					   player1.pan+=5*(key_cul-key_cur)*time_step;			  

						VECTOR* mov = vector(0,0,0);		
						if(key_cuu) mov.x= 7*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;   //calculate a ground force
						}	
						mov.z=push_force_z*time_step;
						
			
						vec_rotate(mov,player1.pan);				pXent_moveglobal (me,mov,player1.pan); 
					

.....

}

		if(my.health<=0)
		{
			pXent_kinematic(my, 1); // kinematic object (enable kinematic)
				
			wait(1);
			pXent_settype(my,PH_RIGID,PH_CAPSULE);		
			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);
			return;
			
					/*	ent_remove(me);		
				return;	*/		
		}
		
		wait(1);
		}
}



But anyway thanks for your help! ^^


regards Sebbi
Posted By: xxxxxxx

Re: [PhysX] whole physik is disabling, maybe a bug? - 01/20/11 18:39

so wie ich deinen Code sehe wird dein Player erst frei von den pX-kräften befeit wenn seine gesundheit <= 0 ist -> er kann nicht fallen. dein Player kann sich auch gar nicht bewegen wenn seine Gusundheit größer 0 ist. Er beweg sich tot oder lebendig kein stück.
Ach ja pXent_kinematic muss man nicht jeden frame aufrufen!!!

WICHTIG:
damit es mit pXent_kinematic und pXent_moveglobal functioniert muss man die entity auch zu nem phsik obj. machen.


Du solltest vieleicht mov so definieren
VECTOR mov;
Ich glaube es ist auch nicht gut wenn du den pan wert dierekt veränderst.
glaube ich!
übrigens
if(key_cuu)
mov.x= 7*time_step;

if(key_cud)
mov.x=-7*time_step;
reict völlig oder sollte völlig reichen,

if(key_cuu==1&&key_cud==1)
{mov.x=0;}
ist eigentlich überflüssig
(gilt auch für die unteren zeilen)

(übrings falls du mehrere gegner hast solltest du das Polygon flag abschalten, es nützt auch wenig wenn du pX engine benutzt)

aber sonst sollte es klappen!!!
Sorry ich editier diesen post sehr oft!
Posted By: sebbi91

Re: [PhysX] whole physik is disabling, maybe a bug? - 01/23/11 19:05

Danke für deine Hilfe aber es klappt immer noch nicht -.-

Es ist eigenartig, sobald ich eine Entity versuche zu deaktivieren, spinnt die ganze Physik engine.

1. bewegt sich mein Spieler 1 nicht mehr, Spieler (2,3,4 können wenigsten gerade aus aber nicht mehr zur Seite laufen)

2. Fallen manche Objekte einfach durch das map-Modell (kein Terrain)

3. Wenn ich eine Entity lösche bleibt die Kollisionshülle irgendwie übrig (heißt ich habe ein unsichbares Hinderniss o.O)


ich habe zum physikalischen deaktivieren von meinem Geschützturm diese 2 Möglichkeiten gedacht:

Code:
if(my.health<=0)
		{
			my.emask &=~ENABLE_SCAN;
			my.emask &=~ENABLE_ENTITY;
			my.emask &=~ENABLE_IMPACT;
			set(my,TRANSLUCENT);
			
			my.alpha-=2*time_step;
			if(my.alpha<=0)
			{
			        pXent_setsleep ( me , 1);

		           pXent_enable(me,0);	

				ent_remove(me);		
				return;
			}
		}


oder
Code:
if(my.health<=0)
		{
			my.emask &=~ENABLE_SCAN;
			my.emask &=~ENABLE_ENTITY;
			my.emask &=~ENABLE_IMPACT;
			set(my,TRANSLUCENT);
			
			my.alpha-=2*time_step;
			if(my.alpha<=0)
			{
			        pXent_setsleep ( me , 1);

		               pXent_settype (my,0,0);	

				ent_remove(me);		
				return;
			}
		}




beides legt wie erwähnt die Physik lahm.

Nebenbei erwähnt funktioniert der Befehl "pXent_setgroup"
gar nicht !
ich schreibe ganz normal in die main:
Code:
pXent_setgroup ( player1, 4); 
pXent_setgroup ( player2, 4); 
pXent_setgroup ( player3, 4); 
pXent_setgroup ( player4, 4);



normalerweise müssten die sich jetzt gegenseitig ignorieren und man kann gegenseitig einfach durchlaufen.

Geht natürlich auch nicht!

PHYSX bringt mich langsam zum verzweifeln!!!!! cry
Klingt fast wie ein Fall fürn Support!



Hoffe mir kann irgendjemand helfen!



mfg Sebbi
Posted By: xxxxxxx

Re: [PhysX] whole physik is disabling, maybe a bug? - 01/23/11 20:23

Ja ich kenn das, die PHYSX regt mich auf(sie zwei untbeantwortete Fragen)! beim problem mit pXent_setgroup ist die Lösung klar und sie heißt (oder sollte so heißen):
pX_setgroupcollision
das spinnen bei der px-e. kenn ich und bin deshalb schnell auf c_move umgestigen und wenn mein feind tot war hab ich ihn zum nen pXent gemacht und am ende deaktiviert komischer weise hat es bei diesem deaktivieren keine probleme gegeben(die Probleme waren da aber hatten keine auswirkungen auf den Fall der gegner! warum auch immer?).

"Wenn ich eine Entity lösche bleibt die Kollisionshülle irgendwie übrig (heißt ich habe ein unsichbares Hinderniss o.O)"
geh doch etwas anders vor mach ein Array aus Feinden, Playern...
und lösch diese nie, sondern setze sie einfach an irgene Position wo man sie nich sieht und lass sie solande dort bis sie wieder gebraucht werden(für die zeit disabelst du sie)! wenn man das geschickt macht kann man mit ca. 15 entities was gutes ohne viele Resursen zu verbrauchen machen!

ich empfele dir so oder so das mal im Bug Hunt forum zu Posten!
scheint ja nichts zu sein wo mal nen experte was weiß!

EDIT: was klappt nich das bewegen mit kinenematic oder das bewegen mit movechar nach dem entfernen des objektes?

mfg
xxxxxxx
Posted By: sebbi91

Re: [PhysX] whole physik is disabling, maybe a bug? - 01/29/11 13:32

DT:
---

Sooo für alle die sich mal selbst drann versuchen möchten habe ich hier nun ein sample projekt!
Die Beschreibung liegt bei ^^
Ich denke es ist einfacher mit einem Beispiel skript.

Ich hoffe jemand findet die Bugs!

Viel Erfolg und Danke für euer Bemühen!

mfg sebbi

______________________________________________________________
Here is the File:
Good luck and thanks anyway for a try!


http://www.fileuploadx.de/595419

or

http://www.megaupload.com/?d=2KN0UAT1

______________________________________________________________

ENG
---

So here is a sample file to try to find the bugs.
There are some informations in the script.
I think its easier to have an samle file!

I hope someone could find the bugs!

Thanks for your Try and your help anyway!

best regards Sebbi
Posted By: sebbi91

Re: [PhysX] whole physik is disabling, maybe a bug? - 02/03/11 19:33

hi ,
did anyone solve one of my bugs ?
Posted By: sebbi91

Re: [PhysX] whole physik is disabling, maybe a bug? - 02/08/11 15:12

hi there^^
Is there anyone who find out if this are Engine or Script bugs?

If this are Engine bugs I want to post them under "Bug hunt",to terminate them.

Please, Give it a try.

http://www.megaupload.com/?d=2KN0UAT1
or
http://www.fileuploadx.de/595419


regards sebbi
Posted By: sebbi91

[PhysX] whole physik is disabling - 03/02/11 16:30

Hello,
Sorry for pushing up my tread but i simply want to know if this is an Engine bug bug or my own misstake.

Its simple "Yes" or "No".

If this are Engine bugs I will report theem into "bug Hunting".


I Hope anyone will answer.

regards Sebbi
Posted By: Pappenheimer

Re: [PhysX] whole physik is disabling - 03/02/11 21:27

Tried it with my A 8.02 Pro. Freezing seems to work for both players. Collision box seems not to turn with the tank, red line is red.
© 2024 lite-C Forums