Gamestudio Links
Zorro Links
Newest Posts
loading historical data 1st time
by AndrewAMD. 04/14/23 12:54
Trade at bar open
by juanex. 04/13/23 19:43
Bug in Highpass2 filter
by rki. 04/13/23 09:54
Adding Limit Orders For IB
by scatters. 04/11/23 16:16
FisherN
by rki. 04/11/23 08:38
AUM Magazine
Latest Screens
SHADOW (2014)
DEAD TASTE
Tactics of World War I
Hecknex World
Who's Online Now
2 registered members (Grant, AndrewAMD), 911 guests, and 9 spiders.
Key: Admin, Global Mod, Mod
Newest Members
rki, FranzIII, indonesiae, The_Judge, storrealba
18919 Registered Users
Previous Thread
Next Thread
Print Thread
Rate Thread
PhysX collision hull has wrong position #415715
01/22/13 17:24
01/22/13 17:24
Joined: Aug 2002
Posts: 3,258
Mainz
oliver2s Offline OP
Expert
oliver2s  Offline OP
Expert

Joined: Aug 2002
Posts: 3,258
Mainz
The problem is this:



If the model is not centered in MED (Object->Transform Global->Center model) the PhysX hull/bounding box is automaticly centered in the engine and doesn't fit the original boundig box position anymore. The hull has a wrong position.

Is there another solution than to center the model in MED? Is this the normal behavouir?

Re: PhysX collision hull has wrong position [Re: oliver2s] #415726
01/22/13 21:16
01/22/13 21:16
Joined: Aug 2002
Posts: 3,258
Mainz
oliver2s Offline OP
Expert
oliver2s  Offline OP
Expert

Joined: Aug 2002
Posts: 3,258
Mainz
Anyone?

Re: PhysX collision hull has wrong position [Re: oliver2s] #415729
01/22/13 22:09
01/22/13 22:09
Joined: Jan 2002
Posts: 4,225
Germany / Essen
Uhrwerk Offline
Expert
Uhrwerk  Offline
Expert

Joined: Jan 2002
Posts: 4,225
Germany / Essen
Have you used c_setminmax before registering the entity as a physics entity? Have you tried setting min_x ... max_z by hand?


Always learn from history, to be sure you make the same mistakes again...
Re: PhysX collision hull has wrong position [Re: Uhrwerk] #415730
01/22/13 22:26
01/22/13 22:26
Joined: Aug 2002
Posts: 3,258
Mainz
oliver2s Offline OP
Expert
oliver2s  Offline OP
Expert

Joined: Aug 2002
Posts: 3,258
Mainz
Sure. The engine debug mode shows the right hull. But PhysX uses a shifted hull (if the model was not centered in MED).

Last edited by oliver2s; 01/22/13 22:34.
Re: PhysX collision hull has wrong position [Re: oliver2s] #415746
01/23/13 10:21
01/23/13 10:21
Joined: Aug 2002
Posts: 3,258
Mainz
oliver2s Offline OP
Expert
oliver2s  Offline OP
Expert

Joined: Aug 2002
Posts: 3,258
Mainz
Btw: this problem happens only with PH_BOX.

Re: PhysX collision hull has wrong position [Re: oliver2s] #415750
01/23/13 10:50
01/23/13 10:50
Joined: Oct 2004
Posts: 897
Lgh
rojart Offline
User
rojart  Offline
User

Joined: Oct 2004
Posts: 897
Lgh
Originally Posted By: oliver2s
Is this the normal behavouir?

Yes, this is normal behaviour, take a look at PhysX Plugin Source by CreateCube Algorithm definition.

Originally Posted By: oliver2s
Is there another solution than to center the model in MED?

Yes, check my example below, but you need change the contact algorithm for automatic computation.

Code:
#include <default.c>
#include <ackphysX.h>

ENTITY *Cube;

function on_space_event()
{
	while (key_space){wait (1);}
	
	int i = ent_status(Cube,0); // number of vertices 
	for (; i>0; i--) 
	{    CONTACT* c = ent_getvertex(Cube,NULL,i);    
		c.v.y += 8.0; // raise the vertex (y is the height in DX coordinates)    
		ent_setvertex(Cube,c,i);  
	}
}

function main()
{
	shadow_stencil = 1;
	vec_set(sky_color,vector(76,51,25));
	mouse_mode = 4;
	physX_open();
	level_load(""); 
	pXent_settype(NULL,PH_STATIC,PH_PLANE);
	vec_set(camera.x,vector(-250,0,50));
	you = ent_createterrain(NULL,nullvector,10,10,70);
	ent_setskin(you, bmap_fill(bmap_createblack(32,32,24),COLOR_GREY,100), 1);
	
	Cube = ent_create(CUBE_MDL,vector(0,0,100),NULL);
	ent_setskin(Cube, bmap_fill(bmap_createblack(32,32,24),COLOR_GREEN,100), 1);
	vec_fill(Cube.scale_x, 2);
	c_setminmax(Cube);
	
	int i = ent_status(Cube,0); // number of vertices 
	for (; i>0; i--) 
	{    CONTACT* c = ent_getvertex(Cube,NULL,i);    
		c.v.y += -8.0; // raise the vertex (y is the height in DX coordinates)    
		ent_setvertex(Cube,c,i);  
	}

	set(Cube,SHADOW|LIGHT);
	pXent_settype(Cube,PH_RIGID,PH_BOX);
	
	def_move();
	def_debug();
	d3d_lines = 3;
	
	while(1)
	{
		draw_text("[SPACE] - Reset Origin",5,120,COLOR_GREEN);
		pX_pick();
		wait(1);
	}
}





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: PhysX collision hull has wrong position [Re: rojart] #415761
01/23/13 12:51
01/23/13 12:51
Joined: Aug 2002
Posts: 3,258
Mainz
oliver2s Offline OP
Expert
oliver2s  Offline OP
Expert

Joined: Aug 2002
Posts: 3,258
Mainz
Thank you for your code, but this workaround doesn't seem very accurate too me.

So I guess, if this is normal PhysX behaviour, I need to center the models in MED...


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