I tried to make physic controlled player with PhysX, everything looks working great, but when I push physic objects (box for example) to the corner, object goes through the player (that is bug I guess). Here is the code I've made:
Code:
///////////////////////////////////////////////////////////////////////////////////////////////
///////////////////////////////////////////////////////////////////////////////////////////////

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

///////////////////////////////////////////////////////////////////////////////////////////////
///////////////////////////////////////////////////////////////////////////////////////////////

VECTOR dist;

///////////////////////////////////////////////////////////////////////////////////////////////
///////////////////////////////////////////////////////////////////////////////////////////////

var hero_move_speed = 8;
var hero_turn_speed = 10;

///////////////////////////////////////////////////////////////////////////////////////////////
///////////////////////////////////////////////////////////////////////////////////////////////

function main()
{
	physX_open();
	fps_max = 60;
	level_load("1.WMB");
	wait(1);
}

///////////////////////////////////////////////////////////////////////////////////////////////
///////////////////////////////////////////////////////////////////////////////////////////////

function camera_set()
{
	camera.tilt = -90;
	camera.pan = my.pan;
	vec_set(camera.x,vector(my.x,my.y,my.z + 800));
}

function handle_gravity()
{
	result = c_trace(my.x,vector(my.x,my.y,my.z - 1000),IGNORE_MODELS|USE_BOX);
	if(result > 10)
	{
		accelerate(dist.z,-10,1);
	}
	else
	{
		dist.z = -(result/1.2)+4;
		dist.z = clamp(dist.z,-4,4);
	}
}

function handle_movement()
{
	if(key_w)
	{
		dist.x = hero_move_speed * time_step;
	}
	else
	{
		if(key_s == 0)
		{
			dist.x = 0;			
		}
	} 
	if(key_s)		
	{
		dist.x = -hero_move_speed * time_step;
	}
	else
	{
		if(key_w == 0)
		{
			dist.x = 0;			
		}
	} 
	if(key_a)
	{
		dist.y = hero_move_speed * time_step;
	}
	else
	{
		if(key_d == 0)
		{
			dist.y = 0;			
		}
	} 
	if(key_d)
	{
		dist.y = -hero_move_speed * time_step;
	}
	else
	{
		if(key_a == 0)
		{
			dist.y = 0;			
		}
	}
	my.pan -= hero_turn_speed * mouse_force.x * time_step;
	vec_rotate(dist,my.pan);
}

action hero()
{
	player = my;
	pXent_settype(me,PH_CHAR,PH_BOX);
	while(1)
	{
		handle_gravity();
		handle_movement();
		pXent_movechar(me,dist,my.pan,0);
		camera_set();
		wait(1);
	}
}

action physX_box()
{
	pXent_settype(my,PH_RIGID,PH_BOX); 
	pXent_setmass(my,5);
	pXent_setfriction(my,5);
	pXent_setdamping (my,50,50); 
	pXent_setelasticity(my,0);
}

///////////////////////////////////////////////////////////////////////////////////////////////
///////////////////////////////////////////////////////////////////////////////////////////////

PANEL* gui = 
{
	layer = 1;
	digits(10,0,4,"Arial#24bi",1,player.pan);
	flags = SHOW;
}




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