Gamestudio Links
Zorro Links
Newest Posts
Blobsculptor tools and objects download here
by NeoDumont. 03/28/24 03:01
Issue with Multi-Core WFO Training
by aliswee. 03/24/24 20:20
Why Zorro supports up to 72 cores?
by Edgar_Herrera. 03/23/24 21:41
Zorro Trader GPT
by TipmyPip. 03/06/24 09:27
VSCode instead of SED
by 3run. 03/01/24 19:06
AUM Magazine
Latest Screens
The Bible Game
A psychological thriller game
SHADOW (2014)
DEAD TASTE
Who's Online Now
2 registered members (AndrewAMD, VoroneTZ), 831 guests, and 5 spiders.
Key: Admin, Global Mod, Mod
Newest Members
sakolin, rajesh7827, juergen_wue, NITRO_FOREVER, jack0roses
19043 Registered Users
Previous Thread
Next Thread
Print Thread
Rate Thread
Unregister cloth #479548
04/05/20 19:20
04/05/20 19:20
Joined: May 2009
Posts: 5,370
Caucasus
3run Offline OP
Senior Expert
3run  Offline OP
Senior Expert

Joined: May 2009
Posts: 5,370
Caucasus
Hey!

Does anyone know, how to unregister and remove cloth? Manual suggests to use pXent_settype to unregister it, but after using it, you still can't remove the cloth (Error E1514 in physX_open). There is this 'pXent_reset_cloth' in header, it freezes the whole project! But it kinda seems to work (since I can remove cloth without any problems), it also makes all rigid bodies (which are registered at the time you call this function) stuck in the air!

Greets!


Looking for free stuff?? Take a look here: http://badcom.at.ua
Support me on: https://boosty.to/3rung
Re: Unregister cloth [Re: 3run] #479844
04/30/20 19:06
04/30/20 19:06
Joined: Oct 2004
Posts: 900
Lgh
rojart Offline
User
rojart  Offline
User

Joined: Oct 2004
Posts: 900
Lgh
Hey!
Have you tried the pXent_settype( myCloth, 0, 0 ); or ;ent_remove(ENTITY*); ?


Regards, Robert

Quote
Everything should be made as simple as possible, but not one bit simpler.
by Albert Einstein

PhysX Preview of Cloth, Fluid and Soft Body

A8.47.1P
Re: Unregister cloth [Re: rojart] #479845
04/30/20 19:40
04/30/20 19:40
Joined: May 2009
Posts: 5,370
Caucasus
3run Offline OP
Senior Expert
3run  Offline OP
Senior Expert

Joined: May 2009
Posts: 5,370
Caucasus
Originally Posted by rojart
Have you tried the pXent_settype( myCloth, 0, 0 ); or ;ent_remove(ENTITY*); ?
Hey rojart! Yes, I have tried both... But they didn't work. When I try to unregister the cloth and ptr_remove it, in acknex it's not visible (as if it was removed), but in PVD I can still see it's there... When I throw a ball to it I get E1513 crash in physX_open. But if I call pXent_reset_cloth at the end, it kinda works... but again, the whole thing freezes and rigid bodies created at that time are stopped in the air (as if they unregistered) and I can't see them in PVD and after a while I get E1513 in physX_ent_remove.
Code
#include <default.c>
#include <ackphysX.h>
#include <mtlFX.c>

PANEL* pInfo = NULL;
FONT* fA20b = "Arial#20b";

function fBallinit()
{
	set(my,SHADOW|CAST);
	pXent_settype(my,PH_RIGID,PH_SPHERE);
	pXent_setmass(my,6);
	pXent_setelasticity(my,100);
	pXent_addvelcentral(my,vec_rotate(vector(1000,0,400),camera.pan));
	pXent_addtorquelocal(my,vector(100,5,0));
	wait(-30);
	ent_remove(me);
}

function on_space_event()
{
	ent_create ("basket_ball.mdl", camera.x, fBallinit);
}


function main()
{	
	shadow_stencil = 2;
	fps_max = 60;

	level_load("");	
	physX_open();
	vec_set(sky_color,COLOR_BLUE);
	vec_set(sun_angle.pan,vector(300,60,5000));
	vec_set(camera.x,vector(-1200,100,500));
	vec_set(camera.pan,vector(0,-10,0));

	// generate ground plane
	ENTITY *ground = ent_createterrain(NULL,vector(0,0,0),16,16,1000);
	bmap_fill(bmap_for_entity(ground,0),COLOR_GREEN,100);
	pXent_settype(NULL,PH_STATIC,PH_PLANE);
	
	// generate flag pole	
	ENTITY *pole = ent_create(CUBE_MDL,vector(0,0,40*8),NULL);
	vec_set(pole.scale_x,vector(0.5,0.5,40));
	vec_set(pole.pan,vector(0,0,0));
	vec_set(pole.blue,COLOR_WHITE);
	set(pole,SHADOW|CAST);
	pXent_settype(pole,PH_STATIC,PH_BOX);

	// generate flag
	ENTITY *cloth = ent_create("clothflag.mdl",NULL,NULL);
	vec_set(cloth.pan,vector(0,0,0));
	cloth.material = mtl_twosided_alpha;
	cloth.ambient = 50;
	set(cloth,SHADOW|CAST);
	set(cloth.material,PASS_SOLID); // required for shadow
	
	// attach flag to pole
	c_setminmax(pole);
	c_setminmax(cloth);
	vec_set(cloth.x,vector(
	pole.x,
	pole.y+(cloth.max_y-cloth.min_y)/2,
	pole.z+pole.max_z-(cloth.max_z-cloth.min_z)/2));
	
	// setup flag cloth	
	var cloth_options[40];
	memcpy(cloth_options,CLOTH_DEFAULT,40*sizeof(var));
	vec_set(cloth_options[25],vector(-10,20,0));  // external acceleration
	vec_set(cloth_options[28],vector(5,10,5));  // random wind acceleration
	cloth_options[9] = 4; // Tear Factor
	cloth_options[37] |= NX_CLF_GRAVITY|NX_CLF_BENDING|NX_CLF_COLLISION_TWOWAY|NX_CLF_SELFCOLLISION|NX_CLF_TEARABLE|NX_CLF_BENDING_ORTHO;
	
	pXent_cloth(cloth,pole,NX_CLOTH_ATTACHMENT_TWOWAY,0,0,cloth_options);
	
	var counter = 5;
	while(counter > 0)
	{
		counter -= time_frame / 16;
		DEBUG_VAR(counter, 0);
		wait(1);
	}
	
	pXent_settype( cloth, 0, 0 );
	ptr_remove(cloth);
	pXent_reset_cloth();
}



Looking for free stuff?? Take a look here: http://badcom.at.ua
Support me on: https://boosty.to/3rung
Re: Unregister cloth [Re: 3run] #479849
04/30/20 21:01
04/30/20 21:01
Joined: Oct 2004
Posts: 900
Lgh
rojart Offline
User
rojart  Offline
User

Joined: Oct 2004
Posts: 900
Lgh
Ok, thanks for the problem, I will try to solve this problem, but it may take a while.

ps
Do you already know PhysX 4.x and PhysX 5.0?


Regards, Robert

Quote
Everything should be made as simple as possible, but not one bit simpler.
by Albert Einstein

PhysX Preview of Cloth, Fluid and Soft Body

A8.47.1P
Re: Unregister cloth [Re: 3run] #479850
04/30/20 21:17
04/30/20 21:17
Joined: May 2009
Posts: 5,370
Caucasus
3run Offline OP
Senior Expert
3run  Offline OP
Senior Expert

Joined: May 2009
Posts: 5,370
Caucasus
Nope, I didn't know that there are newer versions above 3.x (didn't really follow their development/updates).
I would be happy to have even 3.x working in acknex (not even talking about new 4.x or 5.x) grin
But unfortunately, I guess this never going to happen.


Looking for free stuff?? Take a look here: http://badcom.at.ua
Support me on: https://boosty.to/3rung

Moderated by  HeelX, Spirit 

Gamestudio download | chip programmers | Zorro platform | shop | Data Protection Policy

oP group Germany GmbH | Birkenstr. 25-27 | 63549 Ronneburg / Germany | info (at) opgroup.de

Powered by UBB.threads™ PHP Forum Software 7.7.1