Gamestudio Links
Zorro Links
Newest Posts
Help with plotting multiple ZigZag
by degenerate_762. 04/30/24 23:23
M1 Oversampling
by 11honza11. 04/30/24 08:16
Trading Journey
by howardR. 04/28/24 09:55
Zorro Trader GPT
by TipmyPip. 04/27/24 13:50
AUM Magazine
Latest Screens
The Bible Game
A psychological thriller game
SHADOW (2014)
DEAD TASTE
Who's Online Now
3 registered members (vicknick, 7th_zorro, 1 invisible), 887 guests, and 3 spiders.
Key: Admin, Global Mod, Mod
Newest Members
firatv, wandaluciaia, Mega_Rod, EternallyCurious, howardR
19050 Registered Users
Previous Thread
Next Thread
Print Thread
Rate Thread
Page 1 of 2 1 2
PhysX enabled player character #375205
06/24/11 10:39
06/24/11 10:39
Joined: Apr 2008
Posts: 650
Sajeth Offline OP
User
Sajeth  Offline OP
User

Joined: Apr 2008
Posts: 650
Yep, I've been trying for days and can't find a way to get acceptable results.
NX_BF_KINEMATIC doesnt seem to work at all.
PH_CHAR provides acceptable movement BUT is very indifferent to its surrounding - walking up very steep ramps, pushing all objects aside disregarding their mass.
Using PH_BOX solves the problems PH_CHAR had; by disabling gravity for the player entity and using a custom gravity function I can also eliminate the problem of the player sliding around all the time - but this results in jerky movement.

So... anyone has any experience with this?


Teleschrott-Fan.
Re: PhysX enabled player character [Re: Sajeth] #375374
06/25/11 10:03
06/25/11 10:03
Joined: Apr 2008
Posts: 650
Sajeth Offline OP
User
Sajeth  Offline OP
User

Joined: Apr 2008
Posts: 650
Anyone tried anything like that yet?
Maybe I should just go with a c_move-Entity and use collision events to kick objects aside?


Teleschrott-Fan.
Re: PhysX enabled player character [Re: Sajeth] #375376
06/25/11 10:09
06/25/11 10:09
Joined: May 2009
Posts: 5,370
Caucasus
3run Offline
Senior Expert
3run  Offline
Senior Expert

Joined: May 2009
Posts: 5,370
Caucasus
I tried to make good, solid movement with those, and after few weeks I gave up...
I advice you to use "c_move" (but even this one is sucks, cause of ellipsoid hull).


Looking for free stuff?? Take a look here: http://badcom.at.ua
Support me on: https://boosty.to/3rung
Re: PhysX enabled player character [Re: 3run] #375396
06/25/11 12:43
06/25/11 12:43
Joined: Apr 2008
Posts: 650
Sajeth Offline OP
User
Sajeth  Offline OP
User

Joined: Apr 2008
Posts: 650
Irgendwie werd ich generell mit der PhysX-Implementierung nicht glücklich... das kommt alles irgendwie immer aufs selbe raus, die ganzen Parameter haben nur minimalste Auswirkungen...


Teleschrott-Fan.
Re: PhysX enabled player character [Re: Sajeth] #375450
06/25/11 19:36
06/25/11 19:36
Joined: May 2009
Posts: 5,370
Caucasus
3run Offline
Senior Expert
3run  Offline
Senior Expert

Joined: May 2009
Posts: 5,370
Caucasus
Sorry I don't know German, but Google translator helped me this time laugh
I have to agree, I don't like PhysX implementation too. I played alot with car physics, but no realistic results...


Looking for free stuff?? Take a look here: http://badcom.at.ua
Support me on: https://boosty.to/3rung
Re: PhysX enabled player character [Re: 3run] #375526
06/26/11 09:44
06/26/11 09:44
Joined: Apr 2006
Posts: 273
Germany, NRW
Meerkat Offline
Member
Meerkat  Offline
Member

Joined: Apr 2006
Posts: 273
Germany, NRW
Also PhysX für Bälle zu benutzen da kann ich mich nicht beschweren. Da wirkt das alles recht gut. Der andere Krams kommt ja noch auf mich zu. Sollte das so sein wie ihr sagt, dann hoffe ich das da noch ordentlich ausgebessert wird. laugh


http://www.gpi-studios.com

OS: Windows 7 Home Premium (64 Bit Version)
AMD Athlon 64 X2 Dual Core Processor 5200+
6gb DDR 2 - RAM
NVIDIA GeForce GTX 460
GameStudio Version A8 Commercial
Re: PhysX enabled player character [Re: Sajeth] #375534
06/26/11 10:31
06/26/11 10:31
Joined: Jun 2009
Posts: 8
Romania
A
AlexMP Offline
Newbie
AlexMP  Offline
Newbie
A

Joined: Jun 2009
Posts: 8
Romania
I did this using a sphere, but there is no colision for the upper part of the body.

Re: PhysX enabled player character [Re: AlexMP] #375539
06/26/11 11:22
06/26/11 11:22
Joined: Apr 2008
Posts: 650
Sajeth Offline OP
User
Sajeth  Offline OP
User

Joined: Apr 2008
Posts: 650
How did you solve the problem with the Player sliding around whenever the ground is not perfectly even? Or didnt you?


Teleschrott-Fan.
Re: PhysX enabled player character [Re: Sajeth] #375547
06/26/11 13:47
06/26/11 13:47
Joined: Nov 2007
Posts: 2,568
Germany, BW, Stuttgart
MasterQ32 Offline
Expert
MasterQ32  Offline
Expert

Joined: Nov 2007
Posts: 2,568
Germany, BW, Stuttgart
hey guys!
i've done some more advanced player code with physX wink
it's very good and i solved the sliding problem
i don't have time to extract all unneccessary things, but here you go:
Code:
action phys_actor()
{
	ent_playerphysic = me;
	set(me,INVISIBLE | PHYSIC_DUMMY);
	pXent_settype(me,PH_RIGID,PH_BALL);
	pXent_setmass(me,76);
	
	VECTOR temp;
	VECTOR mov;
	VECTOR vel;
	
	on_space = phys_actor_jump;
	on_mouse_left = actor_weaponprimary;
	on_mouse_right = actor_weaponsecondary;
	on_r = actor_weaponreload;
	
	on_1 = actor_getweapon1;
	on_2 = actor_getweapon2;
	on_3 = actor_getweapon3;
	
	var time = 0;
	
	my.CAMERA_PAN = camera.pan;
	my.CAMERA_TILT = camera.tilt;
	
	var fall_damage_last_z = my.z;
	var fall_damage_distance = 0;
	var fall_damage_last_distance = 0;
	var fall_damage_testtime = 1;
	
	var movement_time = 0;
	
	while(me)
	{
		my.CAMERA_PAN -= 2 * mouse_force.x / (1 + 3 * var_sniper_zoomed);
		my.CAMERA_TILT = clamp(my.CAMERA_TILT + 2 * mouse_force.y / (1 + 3 * var_sniper_zoomed),-90,90);
		
		time += 0.125 * time_step;
		
		camera.pan = my.CAMERA_PAN + 0.5 * sin(0.125 * time);
		camera.tilt = my.CAMERA_TILT + 0.5 * cos(0.25 * time);
		
		switch(var_weapon_selected)
		{
			case WEAPON_SNIPER:
				ent_weapon_sniper.flags2 |= SHOW;
				ent_weapon_pistol.flags2 &= ~SHOW;
				ent_weapon_knife.flags2 &= ~SHOW;
				if(var_sniper_bullets > 0)
				{
					pan_weapon_sniperbullets.size_x = var_sniper_bullets * 16;
					set(pan_weapon_sniperbullets,SHOW);
				}
				else
				{
					reset(pan_weapon_sniperbullets,SHOW);
				}
				reset(pan_weapon_pistolbullets,SHOW);
				break;
			case WEAPON_PISTOL:
				ent_weapon_sniper.flags2 &= ~SHOW;
				ent_weapon_pistol.flags2 |= SHOW;
				ent_weapon_knife.flags2 &= ~SHOW;
				var_sniper_zoomed = 0;
				reset(pan_weapon_sniperbullets,SHOW);
				if(var_pistol_bullets > 0)
				{
					pan_weapon_pistolbullets.size_x = var_pistol_bullets * 17;
					set(pan_weapon_pistolbullets,SHOW);
				}
				else
				{
					reset(pan_weapon_pistolbullets,SHOW);
				}
				
				break;
			case WEAPON_KNIFE:
				ent_weapon_sniper.flags2 &= ~SHOW;
				ent_weapon_pistol.flags2 &= ~SHOW;
				ent_weapon_knife.flags2 |= SHOW;
				var_sniper_zoomed = 0;
				reset(pan_weapon_sniperbullets,SHOW);
				reset(pan_weapon_pistolbullets,SHOW);
				break;
			case WEAPON_EMPTY:
				ent_weapon_sniper.flags2 &= ~SHOW;
				ent_weapon_pistol.flags2 &= ~SHOW;
				ent_weapon_knife.flags2 &= ~SHOW;
				var_sniper_zoomed = 0;
				reset(pan_weapon_sniperbullets,SHOW);
				reset(pan_weapon_pistolbullets,SHOW);
				break;
		}
		
		if(var_sniper_zoomed)
		{
			var_sniper_zoomfac = clamp(var_sniper_zoomfac - mickey.z / 60,5,40);
		}
		else
		{
			var_weapon_selected = cycle(var_weapon_selected - mickey.z / 120,0,4);
		}
		
		if(key_w || key_s || key_a || key_d)
		{
			vec_set(mov,vector((key_w - key_s) * 150 * time_step,(key_a - key_d) * 100 * time_step,0));
			vec_rotate(mov,vector(camera.pan,0,0));
			pXent_getvelocity(me,vel,nullvector);
			vel.x = -1 * vel.x * time_step + mov.x;
			vel.y = -1 * vel.y * time_step + mov.y;
			vel.z = 0;
			pXent_addvelcentral(me,vel);
			pXent_addvelcentral(me,mov);
			
			movement_time = 4;
		}
		else
		{
			pXent_getvelocity(me,vel,nullvector);
			vel.x = -1 * vel.x * time_step;
			vel.y = -1 * vel.y * time_step;
			if(c_trace(ent_playerphysic.x,vector(ent_playerphysic.x,ent_playerphysic.y,ent_playerphysic.z - 20),IGNORE_PASSABLE | IGNORE_ME) && !phys_actor_jumping)
			{
				vel.z = -1 * vel.z * time_step;
			}
			else
			{
				vel.z = 0;
			}
			pXent_addvelcentral(me,vel);
			movement_time -= time_step;
		}
		
		if(movement_time < 0)
		{
			pXent_setbodyflag(me,NX_BF_FROZEN_POS_X,1);
			pXent_setbodyflag(me,NX_BF_FROZEN_POS_Y,1);
		}
		else
		{
			pXent_setbodyflag(me,NX_BF_FROZEN_POS_X,0);
			pXent_setbodyflag(me,NX_BF_FROZEN_POS_Y,0);
		}
		
		
		vec_set(ent_playerdummy.x,my.x);
		ent_playerdummy.z += 22;
		
		vec_set(camera.x,ent_playerdummy.x);
		camera.z += 32;
		
		ent_playerdummy.pan = camera.pan;
		
		if(var_sniper_zoomed)
		{
			camera.arc = var_sniper_zoomfac;
			set(pan_weapon_sniperscope,SHOW);
			//set(pan_weapon_snipertarget,SHOW);
			
			VECTOR target_pos;
			weapon_sniper_gethitpoint(target_pos,camera.x,camera.pan);
			vec_to_screen(target_pos,camera);
			pan_weapon_snipertarget.pos_x = target_pos.x - 7;
			pan_weapon_snipertarget.pos_y = target_pos.y - 7;
			
			var scale_x = screen_size.x / bmap_width(pan_weapon_sniperscope.bmap);
			var scale_y = screen_size.y / bmap_height(pan_weapon_sniperscope.bmap);
			
			pan_weapon_sniperscope.scale_x = scale_x;
			pan_weapon_sniperscope.scale_y = scale_y;
			
			ent_weapon_sniper.flags2 &= ~SHOW;
			
			VECTOR from;
			VECTOR to;
			
			vec_set(from,camera.x);
			
			vec_set(to,vector(var_sniper_range,0,0));
			vec_rotate(to,camera.pan);
			vec_add(to,camera.x);
			
			var dist = c_trace(from,to,IGNORE_PASSABLE | IGNORE_ME);
			
			VECTOR center;
			vec_set(center,screen_size.x);
			vec_scale(center,0.5);
			
			draw_line(vector(center.x - 350 * scale_x, center.y,0),COLOR_RED,0);
			draw_line(vector(center.x - 350 * scale_x, center.y,0),COLOR_RED,100);
			draw_line(vector(center.x - 25, center.y,0),COLOR_RED,100);
			draw_line(vector(center.x - 25, center.y,0),COLOR_RED,0);
			
			draw_line(vector(center.x + 25, center.y,0),COLOR_RED,0);
			draw_line(vector(center.x + 25, center.y,0),COLOR_RED,100);
			draw_line(vector(center.x + 350 * scale_x, center.y,0),COLOR_RED,100);
			draw_line(vector(center.x + 350 * scale_x, center.y,0),COLOR_RED,0);
			
			draw_line(vector(center.x,center.y - 350 * scale_y,0),COLOR_RED,0);
			draw_line(vector(center.x,center.y - 350 * scale_y,0),COLOR_RED,100);
			draw_line(vector(center.x,center.y - 25,0),COLOR_RED,100);
			draw_line(vector(center.x,center.y - 25,0),COLOR_RED,0);
			
			draw_line(vector(center.x,center.y + 25,0),COLOR_RED,0);
			draw_line(vector(center.x,center.y + 25,0),COLOR_RED,100);
			draw_line(vector(center.x,center.y + 350 * scale_y,0),COLOR_RED,100);
			draw_line(vector(center.x,center.y + 350 * scale_y,0),COLOR_RED,0);
			
			draw_text(str_printf(NULL,"Distanz: %im",(int)dist / 64),center.x + 25,center.y - 17,COLOR_WHITE);
			
			VECTOR temp;
			vec_set(temp,vWind);
			vec_rotate(temp,vector(-camera.pan,0,0));
			
			var debug_wind = center.x - temp.y * 4;
			
			draw_line(vector(center.x,16,0),COLOR_BLUE,0);
			draw_line(vector(center.x,16,0),NULL,100);
			draw_line(vector(center.x,32,0),COLOR_BLUE,100);
			draw_line(vector(center.x,32,0),COLOR_BLUE,0);
			
			draw_line(vector(debug_wind,16,0),COLOR_GREEN,0);
			draw_line(vector(debug_wind,16,0),NULL,100);
			draw_line(vector(debug_wind,32,0),COLOR_GREEN,100);
			draw_line(vector(debug_wind,32,0),COLOR_GREEN,0);
		}
		else
		{
			camera.arc = 60;
			reset(pan_weapon_sniperscope,SHOW);
			reset(pan_weapon_snipertarget,SHOW);
		}
		
		var_weapon_shottime -= time_step;
		
		if(fall_damage_testtime < 0)
		{
			fall_damage_distance = my.z - fall_damage_last_z;
			
			if((fall_damage_distance - fall_damage_last_distance) > 35)
				ent_playerdummy.HEALTH -= 4;
				
			fall_damage_last_z = my.z;
			fall_damage_last_distance = fall_damage_distance;
			fall_damage_testtime = 2;
		}
		
		fall_damage_testtime -= time_step;
	
		wait(1);
	}
}




Visit my site: www.masterq32.de
Re: PhysX enabled player character [Re: MasterQ32] #375567
06/26/11 15:42
06/26/11 15:42
Joined: Apr 2008
Posts: 650
Sajeth Offline OP
User
Sajeth  Offline OP
User

Joined: Apr 2008
Posts: 650
Okay, very good idea - I'm gonna try doing something similar with NX_BF_FROZEN-flags! Thanks for sharing your code!


Teleschrott-Fan.
Page 1 of 2 1 2

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