Gamestudio Links
Zorro Links
Newest Posts
Free Live Data for Zorro with Paper Trading?
by AbrahamR. 05/18/24 13:28
Change chart colours
by 7th_zorro. 05/11/24 09:25
Data from CSV not parsed correctly
by dr_panther. 05/06/24 18:50
AUM Magazine
Latest Screens
The Bible Game
A psychological thriller game
SHADOW (2014)
DEAD TASTE
Who's Online Now
1 registered members (AbrahamR), 717 guests, and 4 spiders.
Key: Admin, Global Mod, Mod
Newest Members
Hanky27, firatv, wandaluciaia, Mega_Rod, EternallyCurious
19051 Registered Users
Previous Thread
Next Thread
Print Thread
Rate Thread
Player movement near other model #416698
02/03/13 16:38
02/03/13 16:38
Joined: Oct 2012
Posts: 20
Lithuania, Kaunas
TerraCratis Offline OP
Newbie
TerraCratis  Offline OP
Newbie

Joined: Oct 2012
Posts: 20
Lithuania, Kaunas
Hi,
Is it possible to move player near tree more?


I using this code:
Code:
function player_camera()
	{
		while (1)
   	{
			if (key_w) {
				me.pan = camera.pan;
				camera.x = me.x-120*cos(me.pan);
				camera.y = me.y-120*sin(me.pan);
			} else {
				camera.x = me.x-120*cos(camera.pan);
				camera.y = me.y-120*sin(camera.pan);
			}
				camera.z = me.z+50;
     	 		wait (1);
  		 }
	}
var mouse_speed = 4;
var walking_speed = 6;
var running_speed = 10;
var gravity_force = 2;
var jump_strength = 10;
var feet_height = 40;
var anim_walk_speed = 5;
var anim_stand_speed = 5;

action player_action()
{
	wait(1);
	//c_updatehull(me, 1);
	//c_setminmax(me);
	set(me, POLYGON);
	var gravity = 0;
	player_camera();
	var lks = 0;
	
	while(me)
	{
		my.pan += mouse_speed * mouse_force.x;
		
		VECTOR mov;
		mov.x = key_w - key_s;
		mov.y = key_a - key_d;
		mov.z = 0;
		if(key_shift)
			vec_normalize(mov, running_speed * time_step);
		else
			vec_normalize(mov, walking_speed * time_step);
	
		if(vec_length(mov) > 0)
		{
			ent_animate(me, "walkA", total_ticks * anim_walk_speed, ANM_CYCLE);	// Adopt animation speed and name
		}
		else
		{
			ent_animate(me, "standA", total_ticks * anim_stand_speed, ANM_CYCLE);	// Adopt animation speed and name
		}
	
		if(key_space != lks)
		{
			if(key_space)
				gravity = jump_strength;
			lks = key_space;
		}
		gravity -= gravity_force * time_step;
		move_friction = 0;
		c_move(me, mov, vector(0, 0, gravity * time_step), GLIDE | IGNORE_PASSABLE | IGNORE_PASSENTS | USE_POLYGON);
		if(c_trace(my.x, vector(my.x, my.y, my.z - feet_height), IGNORE_ME | IGNORE_PASSABLE | IGNORE_PASSENTS | USE_POLYGON))
		{
			my.z = target.z + feet_height;
			gravity = 0;
		}
		wait(1);
	}
}


All entities and trees has
Code:
set(me, POLYGON);


I tried to use c_updatehull(me, 1); and c_setminmax(me); but effect is same.
And one more problem - sometimes player walks throught building wall, but its not passable.


Last edited by TerraCratis; 02/03/13 16:40.

Sorry for my english smirk
Re: Player movement near other model [Re: TerraCratis] #416700
02/03/13 16:50
02/03/13 16:50
Joined: Sep 2003
Posts: 6,861
Kiel (Germany)
Superku Offline
Senior Expert
Superku  Offline
Senior Expert

Joined: Sep 2003
Posts: 6,861
Kiel (Germany)
Using POLYGON for the tree only (NOT for the player) and c_setminmax for both is the correct way. Press F11 twice to check the bounding box of the player in the engine, it will be too big so set the min-max vectors of the player manually after his c_setminmax call.


"Falls das Resultat nicht einfach nur dermassen gut aussieht, sollten Sie nochmal von vorn anfangen..." - Manual

Check out my new game: Pogostuck: Rage With Your Friends
Re: Player movement near other model [Re: Superku] #416712
02/03/13 18:26
02/03/13 18:26
Joined: Oct 2012
Posts: 20
Lithuania, Kaunas
TerraCratis Offline OP
Newbie
TerraCratis  Offline OP
Newbie

Joined: Oct 2012
Posts: 20
Lithuania, Kaunas
Originally Posted By: Superku
Using POLYGON for the tree only (NOT for the player) and c_setminmax for both is the correct way. Press F11 twice to check the bounding box of the player in the engine, it will be too big so set the min-max vectors of the player manually after his c_setminmax call.

Much better, thanks wink


Sorry for my english smirk

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