OK, so as I realized, in "physics" forum, no one was able to answer me.
That the main reason for that I've decided to ask my questions here.
I'm trying to make simple 2D movement, with BOX hull shape for player.
I need to move character only in X coordinates, all other coordinated should be locked.
I need physic object to be able to turn only in TILT, all other angles should be locked.
I want character to react for all forces and gravity as well, not only movement forces by keys.
Here you can download demo of what I've tried to do:
Download link
And you can see it here (for those lazy ones):
Code:
///////////////////////////////////////////////////////////////////////////////
#include <acknex.h>
#include <default.c>
#include <ackphysX.h>
///////////////////////////////////////////////////////////////////////////////
STRING* test_wmb = "test.WMB";
///////////////////////////////////////////////////////////////////////////////
action object()
{
	pXent_settype(my,PH_RIGID,PH_BOX); // dynamic box
	pXent_setskinwidth(my,0); 
	pXent_setccdskeleton(my,vector(0,0,0),1); 
}
///////////////////////////////////////////////////////////////////////////////
function set_camera()
{
	vec_set(camera.x,vector(my.x,my.y - 700,my.z));
	camera.pan = 90;
	camera.tilt = 0;
}
///////////////////////////////////////////////////////////////////////////////
action hero()
{
	VECTOR temp;
	player = my;
	pXent_settype(my,PH_CHAR,PH_BOX); // box character
	wait(1); // wait one frame as manual says
	pXent_setskinwidth(my,0);  
	pXent_setccdskeleton(my,vector(0,0,0),1); 
	while(1)
	{
		temp.x = 10 * (key_d - key_a) * time_step; 
		temp.y = 10 * (key_w - key_s) * time_step; 
		temp.z = 10 * (key_q - key_e) * time_step;
		pXent_moveglobal(my,temp,nullvector);  		
		//pXent_movechar(my,temp,nullvector,0);
		set_camera();
		wait(1);
	}
}
///////////////////////////////////////////////////////////////////////////////
function main()
{
	fps_max = 60;
	physX_open(); // load physX
	level_load(test_wmb); // load level
	wait(3); // wait for 3 frames
	pX_setccd(1); // activate CCD
	// make nice 2D physics
	pXent_setbodyflagall(NX_BF_FROZEN_POS_Y|NX_BF_FROZEN_PAN|NX_BF_FROZEN_ROLL,1);	
	pX_setgravity(vector(0,0,-9.81)); // apply earth gravity
}
///////////////////////////////////////////////////////////////////////////////

So, my questions are:
* how to lock all physic objects in Y, Z, PAN, ROLL (pXent_setbodyflagall doesn't help)?
* how to make PH_CHAR object to react on other forces (for example, gravity and explosions)?
* how to make character collide with other RIGID bodies properly (so they don't pass throw each other, CCD doesn't help)?


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