pX_setgroupcollision doesn't work?

Posted By: 3run

pX_setgroupcollision doesn't work? - 01/27/13 11:03

Doesn't it work with PH_CHAR?? Manual said nothing about that.. I tried to use it, to disable the collusions between player and the platform. I use PH_CHAR for both of them (one CAPSULE and another one BOX). But they still have collusions... Using pXent_setgroup doesn't help as well.. when I use it, have no idea why but it messes up the code, so neither player or platform move, if player is standing on it! Can anyone conform this? Or doesn't it simply work with PH_CHAR?

What I actually try to archive, is to make platform be able to pass throw the player, to do not stop on him, but player shouldn't be able to pass throw the platform.

Plus, does pXent_setbodyflag work with PH_CHAR? I can't get it to work as well (it works with PH_RIGID very well).
Posted By: 3run

Re: pX_setgroupcollision doesn't work? - 01/28/13 01:43

little bump here, I don't this to be vanished..
Posted By: Superku

Re: pX_setgroupcollision doesn't work? - 01/28/13 01:50

What are your group numbers, are they 0 or 1?
If nothing works you can move them manually if the player stands on the platform (f.i. disable their physics, move them, or move player first vertically if platform goes up, then the platform, ...).
Posted By: 3run

Re: pX_setgroupcollision doesn't work? - 01/28/13 01:58

Nope, I use group 3 for player and 4 for platforms.

Everything works pretty nice at the moment.
When I stand on the platform, I add it's velocity as a global vector to player's movement, like this:
Code:
absForce.x += you.speedX;
absForce.y += you.speedY;

Z - adaptation isn't needed, as it's made by gravity, and anyway, platforms don't move in Z direction, only X or Y.
This is just a idea of how I make player move with the platform, it's framerate independent in script (not as in example).
Thing is, that when player falls down from the platform, it tries to move throw him, and starts moving upwards (cause of capsule hull).

Edit: I didn't really understand, what you've mean by moving them manually.. I already to move them manually, do I?
Posted By: Superku

Re: pX_setgroupcollision doesn't work? - 01/28/13 02:09

I thought you were talking about z-platforms, and I thought the upward movement was blocked by the player, so never mind then.
Posted By: 3run

Re: pX_setgroupcollision doesn't work? - 01/28/13 02:19

sad.. frown I hope someone will be able to lend a hand...
Posted By: 3dgs_snake

Re: pX_setgroupcollision doesn't work? - 01/28/13 05:16

Hi,

Firstly, using physX3 plugin you can do grin
Code:
pX3ent_setcollisionflag(capsule, cube, PX_PF_IGNORE_PAIR);



With the physX2 plugin, I think that collision filtering doesn't work with CCT. A thing you can do is create an invisible trigger bellow your moving platform. When your cct enters the trigger, you set the trigger flag of your moving platform (So cct will not collide with it). You need to reset it when cct is leaving the trigger volume.
Posted By: 3run

Re: pX_setgroupcollision doesn't work? - 01/28/13 10:35

If it doesn't work in native physics.. then it's very uncomfortable and makes the movement almost useless.. Maybe it's kind of a bug? Or doesn't physX2 support it for the CCT?
Posted By: 3dgs_snake

Re: pX_setgroupcollision doesn't work? - 01/28/13 10:45

No, I think It's not a bug. Group collision mask needs to be provided while moving a cct in physX2. I think that the physX plugin have all groups activated.
Posted By: rojart

Re: pX_setgroupcollision doesn't work? - 01/29/13 05:01

Originally Posted By: 3run
Doesn't it work with PH_CHAR?? Manual said nothing about that.. I tried to use it, to disable the collusions between player and the platform. I use PH_CHAR for both of them (one CAPSULE and another one BOX). But they still have collusions... Using pXent_setgroup doesn't help as well.. when I use it, have no idea why but it messes up the code, so neither player or platform move, if player is standing on it! Can anyone conform this? Or doesn't it simply work with PH_CHAR?

What I actually try to archive, is to make platform be able to pass throw the player, to do not stop on him, but player shouldn't be able to pass throw the platform.

Plus, does pXent_setbodyflag work with PH_CHAR? I can't get it to work as well (it works with PH_RIGID very well).

Check out what is going on in the sourcecode with pXent_setbodyflag?
Posted By: 3dgs_snake

Re: pX_setgroupcollision doesn't work? - 01/29/13 05:26

Quote:
I tried to use it, to disable the collusions between player and the platform. I use PH_CHAR for both of them (one CAPSULE and another one BOX).


I think you should not use PH_CHAR for a moving platform. You should use kinematic body instead.
Posted By: rojart

Re: pX_setgroupcollision doesn't work? - 01/30/13 00:27

Ok I checked the CCT and I found what was going wrong.

Originally Posted By: 3run
... does pXent_setbodyflag work with PH_CHAR? I can't get it to work as well (it works with PH_RIGID very well).

pXent_setbodyflag works only with dynamic physics object.

Originally Posted By: 3run
Doesn't it work with PH_CHAR?? Manual said nothing about that.. I tried to use it, to disable the collusions between player and the platform. I use PH_CHAR for both of them (one CAPSULE and another one BOX)...

Firstly check this dll, should work because in the CCT definition I found out that interactionFlag option was not used and by default your PH_CHAR model always collide.

Note: If a character controller will collide with another controller. There are 3 options: always collide, never collide and collide based on the shape group (NXIF_INTERACTION_INCLUDE, NXIF_INTERACTION_EXCLUDE, NXIF_INTERACTION_USE_FILTER)

In the dll I changed to NXIF_INTERACTION_EXCLUDE for both Capsule and Box, I known it's not the best for now, but I will make it better.
Posted By: 3run

Re: pX_setgroupcollision doesn't work? - 01/30/13 00:55

rojart@ thank you very much. I'll test it now. One more question, is there a way, to make platform ignore player, but to keep collusions for player?

Edit: problem is, that when platform collides with player, it's starts changing it's Z position, in order to pass throw the player.. I can't keep Z position fixed, so I need platform to ignore the player, but player itself should be able to collide with it.
Posted By: 3dgs_snake

Re: pX_setgroupcollision doesn't work? - 01/30/13 04:52

Hi,

As I said, you can't use CCT grin , CCT has an "auto stepping" behaviour, that's why the z position is not fixed. You really should use a kinematic body (You need only to change the way you integrate your character).
Posted By: rojart

Re: pX_setgroupcollision doesn't work? - 01/31/13 06:12

Originally Posted By: 3run
rojart@ thank you very much. I'll test it now. One more question, is there a way, to make platform ignore player, but to keep collusions for player?

Edit: problem is, that when platform collides with player, it's starts changing it's Z position, in order to pass throw the player.. I can't keep Z position fixed, so I need platform to ignore the player, but player itself should be able to collide with it.

I'm glad I could help, so if I understand right, your player should Collide when moving to the platform, but if platform move to the player his Collision should not occur?

Well, I've changed a bit the source code and added new var type PH_CHAR2 which register the entity as a character controller without Collision.

Try the new dll and play with PH_CHAR2 type for the platform, too.

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

#define PH_CHAR2 5 //!< Never collide character controllers.

void main()
{
	physX_open();
	
	level_load(""); //pXent_settype(NULL,PH_STATIC,PH_PLANE);	

	vec_set(camera->x, vector(-150, 0, 0));

	ENTITY *ePlayer = ent_create("CUBE.MDL", vector(0, 30, 0), NULL);
	vec_set(ePlayer.scale_x,vector(.5,.5,1));
	vec_set(ePlayer.blue,COLOR_RED);	set(ePlayer,LIGHT|CAST); c_setminmax(ePlayer);
	pXent_settype(ePlayer, PH_CHAR2, PH_BOX);
	
	ENTITY *platform = ent_create("CUBE.MDL", vector(0, -30, 0), NULL);
	vec_set(platform.scale_x,vector(1,.5,.5));
	vec_set(platform.blue,COLOR_GREEN); set(platform,LIGHT|CAST); c_setminmax(platform);	
	pXent_settype(platform, PH_CHAR, PH_BOX);
	
	ENTITY *eStatic = ent_create("CUBE.MDL", vector(0, 0, 0), NULL);
	vec_set(eStatic.blue,COLOR_WHITE); set(eStatic,LIGHT|CAST); c_setminmax(eStatic);
	pXent_settype(eStatic, PH_STATIC, PH_BOX);

	while(1)
	{
		draw_text("[WASD] Move Red Player", 5, 5, COLOR_RED);
		draw_text("[Arrow keys] Move Green Platform", 5, 30, COLOR_GREEN);
		draw_text("Static Entity", 5, 60, COLOR_WHITE);
		ePlayer.skill1 = 5 * (key_a - key_d) * time_step;
		ePlayer.skill2 = 5 * (key_w - key_s) * time_step;
		platform.skill1 = 5 * (key_cul - key_cur) * time_step;
		platform.skill2 = 5 * (key_cuu - key_cud) * time_step;
		pXent_move(ePlayer, NULL, vector(0, ePlayer.skill1, ePlayer.skill2));
		pXent_move(platform, NULL, vector(0, platform.skill1, platform.skill2));
		wait(1);
	}
}

Posted By: 3run

Re: pX_setgroupcollision doesn't work? - 01/31/13 12:36

Thank you very much man! This will be useful.
Posted By: rojart

Re: pX_setgroupcollision doesn't work? - 02/01/13 00:51

I'm always happy if I can help.

But subject question has annoyed me, why it does not work and I found a bug.

pX_setgroupcollision works very well, but pXent_setgroup not.

I'll describe this later in the bug thread.
© 2024 lite-C Forums