pXent_enable doesnt work

Posted By: MPQ

pXent_enable doesnt work - 02/15/13 14:21

Hi guys,

follwing problem has been appearing recently:
when I use the following code lines:

pXent_enable (me, 0);
vec_set (my.pan, vector (3,0,0));
pXent_enable (me, 1);

the physics entity gets automatically restored to its old angle after calling pXent_enable.
But

pXent_enable (me, 0);
vec_set (my.x, vecotr (3,0,0));
pXent_enable (me, 1);

works fine for me. The entity stays at its place after enableing the physX- engine.

So y does the angle-altering not work? Can anybody reproduce the bug?
Posted By: rojart

Re: pXent_enable doesnt work - 02/16/13 13:35

Originally Posted By: MPQ
...
the physics entity gets automatically restored to its old angle after calling pXent_enable.
...

Yes, if you use PH_CHAR, but not for static and dynamic hulls.

Try pXent_rotate(my,NULL,vector(3,0,0)); directly.

Why do you need pXent_enable if PH_CHAR was used?
Posted By: MPQ

Re: pXent_enable doesnt work - 02/19/13 09:57

Ye, tried out pXent_rotate, but the same problem kept the same (dont understand that). So I went back to no-physX movement in my project and everything is workin fine now. I gonna use only static physics object from now on.
Posted By: rojart

Re: pXent_enable doesnt work - 02/19/13 10:20

Originally Posted By: MPQ
Ye, tried out pXent_rotate, but the same problem kept the same (dont understand that)...
Any example?

pXent_rotate works fine for me, like code below:

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

void main()
{
	physX_open();
	
	level_load("");

	vec_set(camera->x, vector(-200, 0, 50));

	ENTITY *box = ent_create("CUBE.MDL", NULL, NULL);
	vec_set(box.scale_x,vector(5,5,.1));
	pXent_settype(box, PH_CHAR, PH_BOX);

	while(1)
	{
		draw_text("[Space] - Rotate", 5, 5, COLOR_RED);
		if (key_space)	pXent_rotate(box,NULL,vector(45,0,0));		
		wait(1);
	}
}

Posted By: MPQ

Re: pXent_enable doesnt work - 02/19/13 11:33

yes you are right, that works for me, too. But I am using angle and position correction for my entites in multiplayer. position correction worked so far via pXent_enable while angle correction was causing the problem above even when I used pXent_rotate the entity's angle got restored within the next frame after calling an other pXent_rotate-instruction. Maybe the pXent_rotate inside an event function caused the problem.

Nevertheless, when I managed to get through all this multiplayer stuff I gonna give physics movement an other chance!
Posted By: 3run

Re: pXent_enable doesnt work - 02/19/13 11:39

rojart@ I faced this problem as well. Try to register object as a PH_CHAR, then move it, after that unregister it and change the angle via vec_set, then wait for one frame and register is as a PH_CHAR again. When I was making respawn system, I've faced this problem, that PH_CHAR (at least what I've noticed) doesn't change the angle.
Posted By: 3dgs_snake

Re: pXent_enable doesnt work - 02/19/13 11:50

Hi,

PH_CHAR only have a position, CCT Controller doesn't rotate (internally). If you want to have a CCT that can be rotated, you need to use a kinematic actor.
Posted By: MPQ

Re: pXent_enable doesnt work - 02/19/13 13:11

thx guys, good to know! So it was the right desicion to turn back to non-physics movement in my case.
Posted By: 3dgs_snake

Re: pXent_enable doesnt work - 02/19/13 13:23

That really depends on you. What you can do is create a hidden proxy CCT for physX interactions (like a simple box mirroring the size of real character) and copy its position into another visual entity (The real entity with the details you like), you are then free to rotate it as you like (Only pan rotation is recomended because CCT has a fixed up vector (0, 0, 1)).
© 2024 lite-C Forums