Gamestudio Links
Zorro Links
Newest Posts
Trading Community Project
by danatrader. 05/30/20 20:28
Out of Sample
by danatrader. 05/30/20 20:02
MT4/5 - wrong M1 time
by Grat. 05/30/20 19:14
Sam Foster Sound | Experienced Game Composer for Hire
by titanicpiano14. 05/30/20 15:18
Windows 10 file_write error
by AndrewAMD. 05/30/20 13:57
stencil blur does not work - SOLVED
by NicolaB. 05/30/20 12:13
Question about Pattern - Workshop7
by danatrader. 05/30/20 09:09
Test - watch noncomplete data
by Grat. 05/30/20 05:38
AUM Magazine
Latest Screens
The Space Between
Pogostuck: Rage With Your Friends
Worst Case Z
AckCon'18 - Lotter vs the World 2 - Preview Release
Who's Online Now
10 registered members (3run, alibaba, kvm, Dooley, danatrader, Grat, xbox, onoff, Sniv, 1 invisible), 530 guests, and 7 spiders.
Key: Admin, Global Mod, Mod
Newest Members
PBSeven, Hardi01, Giuseppe, AdamWu, gariki
18460 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,254
Caucasus
3run Online OP
Senior Expert
3run  Online OP
Senior Expert

Joined: May 2009
Posts: 5,254
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
Re: Unregister cloth [Re: 3run] #479844
04/30/20 19:06
04/30/20 19:06
Joined: Oct 2004
Posts: 896
Lgh
rojart Offline
User
rojart  Offline
User

Joined: Oct 2004
Posts: 896
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.45.4P
Re: Unregister cloth [Re: rojart] #479845
04/30/20 19:40
04/30/20 19:40
Joined: May 2009
Posts: 5,254
Caucasus
3run Online OP
Senior Expert
3run  Online OP
Senior Expert

Joined: May 2009
Posts: 5,254
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
Re: Unregister cloth [Re: 3run] #479849
04/30/20 21:01
04/30/20 21:01
Joined: Oct 2004
Posts: 896
Lgh
rojart Offline
User
rojart  Offline
User

Joined: Oct 2004
Posts: 896
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.45.4P
Re: Unregister cloth [Re: 3run] #479850
04/30/20 21:17
04/30/20 21:17
Joined: May 2009
Posts: 5,254
Caucasus
3run Online OP
Senior Expert
3run  Online OP
Senior Expert

Joined: May 2009
Posts: 5,254
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

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