Gamestudio Links
Zorro Links
Newest Posts
Zorro 2.70
by jcl. 09/29/25 09:24
optimize global parameters SOLVED
by dBc. 09/27/25 17:07
ZorroGPT
by TipmyPip. 09/27/25 10:05
assetHistory one candle shift
by jcl. 09/21/25 11:36
Plugins update
by Grant. 09/17/25 16:28
AUM Magazine
Latest Screens
Rocker`s Revenge
Stug 3 Stormartillery
Iljuschin 2
Galactic Strike X
Who's Online Now
5 registered members (Dico, AndrewAMD, TipmyPip, NewbieZorro, Grant), 15,791 guests, and 5 spiders.
Key: Admin, Global Mod, Mod
Newest Members
krishna, DrissB, James168, Ed_Love, xtns
19168 Registered Users
Previous Thread
Next Thread
Print Thread
Rate Thread
player collison #428493
08/28/13 18:33
08/28/13 18:33
Joined: Aug 2013
Posts: 78
Nottingham
DuaneDawson Offline OP
Junior Member
DuaneDawson  Offline OP
Junior Member

Joined: Aug 2013
Posts: 78
Nottingham
hi

I was just wondering something.

I have the player that move with the mouse when clicking in the level.

but I notice when I click in the level for the player to move to that spot. he cant get there if something like a wall is in the way.

do I have to set a path or something for it to follow.
so that he can walk around the objects and get to the spot where clicked?

cheers

Re: player collison [Re: DuaneDawson] #428494
08/28/13 18:39
08/28/13 18:39
Joined: Mar 2011
Posts: 3,150
Budapest
sivan Offline
Expert
sivan  Offline
Expert

Joined: Mar 2011
Posts: 3,150
Budapest
yes. the easiest to use paths consisting of nodes.
or in very simple cases you can use c_trace and estimate the correct turn direction to get to the target.


Free world editor for 3D Gamestudio: MapBuilder Editor
Re: player collison [Re: sivan] #428495
08/28/13 18:46
08/28/13 18:46
Joined: Aug 2013
Posts: 78
Nottingham
DuaneDawson Offline OP
Junior Member
DuaneDawson  Offline OP
Junior Member

Joined: Aug 2013
Posts: 78
Nottingham
is this hard to do?

where can I research this? is there a tutorial for lite.c

cheers

Re: player collison [Re: DuaneDawson] #428496
08/28/13 19:07
08/28/13 19:07
Joined: Jul 2008
Posts: 2,110
Germany
rayp Offline

X
rayp  Offline

X

Joined: Jul 2008
Posts: 2,110
Germany
Dynamic pathfinding is not easy to implement. Maybe obstacle avoidance could be an solution for you. See the AUMs theres one oa example in it. but i dont know in which aum sry.

Edit: A good pathfinding comes with the goodies.zip done by SuperKu aka Felix Pohl. I use it, and i love it.

Last edited by rayp; 08/28/13 19:10.

Acknex umgibt uns...zwischen Dir, mir, dem Stein dort...
"Hey Griswold ... where u gonna put a tree that big ?"
1998 i married my loved wife ... Sheeva from Mortal Kombat, not Evil-Lyn as might have been expected
rayp.flags |= UNTOUCHABLE;
Re: player collison [Re: rayp] #428497
08/28/13 19:11
08/28/13 19:11
Joined: Aug 2013
Posts: 78
Nottingham
DuaneDawson Offline OP
Junior Member
DuaneDawson  Offline OP
Junior Member

Joined: Aug 2013
Posts: 78
Nottingham
ok ill take a look

thank you

Re: player collison [Re: DuaneDawson] #428514
08/29/13 00:59
08/29/13 00:59
Joined: Jul 2008
Posts: 2,110
Germany
rayp Offline

X
rayp  Offline

X

Joined: Jul 2008
Posts: 2,110
Germany
Here is a good obstacle avoidance. I cant give credits, but its not written by myself...iam pretty sure ^^
Code:
////////////////////////////////////////////////////////////////////////////////////////
////////////////////////////////////////////////////////////////////////////////////////
#include <acknex.h>
#include <default.c>
////////////////////////////////////////////////////////////////////////////////////////
////////////////////////////////////////////////////////////////////////////////////////
function camera_setup()
{
	vec_set(camera.x,vector(0,-580,720));
	vec_set(camera.pan,vector(90,-50,0));
	vec_set(d3d_lodfactor,vector(12.5,25,50)); 
	sun_light = 0;
	camera.clip_near = 0;
	camera.clip_far = 4000;
	camera.fog_start = 100; 
	camera.fog_end = 4000; 
	fog_color = 4;
	d3d_fogcolor4.red = 150; 
	d3d_fogcolor4.green = 150; 
	d3d_fogcolor4.blue = 150;
	sky_color.red = d3d_fogcolor4.red; 
	sky_color.green = d3d_fogcolor4.green; 
	sky_color.blue = d3d_fogcolor4.blue; 
}
////////////////////////////////////////////////////////////////////////////////////////
////////////////////////////////////////////////////////////////////////////////////////
function main()
{
	warn_level = 6;
	fps_max = 60;
	video_set(800,600,32,0);
	freeze_mode = 1;
	level_load("1.WMB");
	wait(3);
	freeze_mode = 0;
	camera_setup();
}
////////////////////////////////////////////////////////////////////////////////////////
////////////////////////////////////////////////////////////////////////////////////////
ENTITY* target_ent;
////////////////////////////////////////////////////////////////////////////////////////
////////////////////////////////////////////////////////////////////////////////////////
action target_act()
{
	target_ent = my;
	set(my,TRANSLUCENT|POLYGON);
}
////////////////////////////////////////////////////////////////////////////////////////
////////////////////////////////////////////////////////////////////////////////////////
#define trace_hit1 skill69
#define trace_hit2 skill70

action zombie_act()
{
	VECTOR temp_vec; 
	VECTOR content_left; 
	VECTOR content_right;
	ANGLE temp_angle;
	while(!target_ent){wait(1);}
	wait(1);
	c_setminmax(my);
	set(my,TRANSLUCENT|POLYGON);
	while(1)
	{
		draw_text("BASIC OBSTACLE AVOIDANCE",10,10,COLOR_WHITE);
		if(c_trace(my.x,content_right,IGNORE_ME|USE_POLYGON|IGNORE_PASSABLE) + c_trace(my.x,content_left,IGNORE_ME|USE_POLYGON|IGNORE_PASSABLE) == 0)
		{
			
			vec_set(temp_vec,target_ent.x);  
			vec_sub(temp_vec,my.x); 
			vec_to_angle(temp_angle,temp_vec);
			if(ang(temp_angle.pan - my.pan) < -2 | ang(temp_angle.pan - my.pan) > 2)
			{
				my.pan += sign(ang(temp_angle.pan - my.pan)) * time_step * 7;
			}
		}
		vec_set(content_right,vector(35,-20,0));
		vec_rotate(content_right,my.pan);
		vec_add(content_right,my.x);
		draw_line3d(my.x,NULL,100);
		draw_line3d(my.x,COLOR_RED,100);
		draw_line3d(content_right.x,COLOR_RED,100);
		if(c_trace(my.x,content_right,IGNORE_ME|USE_POLYGON|IGNORE_PASSABLE) != 0 && c_trace(my.x,content_left,IGNORE_ME|USE_POLYGON|IGNORE_PASSABLE) == 0)
		{
			my.trace_hit1 = 1;
			my.pan += 10 * time_step; 
		}
		vec_set(content_left,vector(35,20,0));
		vec_rotate(content_left,my.pan);
		vec_add(content_left,my.x);
		draw_line3d(my.x,NULL,100);
		draw_line3d(my.x,COLOR_RED,100);
		draw_line3d(content_left.x,COLOR_RED,100);
		if(c_trace(my.x,content_left,IGNORE_ME|USE_POLYGON|IGNORE_PASSABLE) != 0 && c_trace(my.x,content_right,IGNORE_ME|USE_POLYGON|IGNORE_PASSABLE) == 0)
		{
			my.trace_hit2 = 1;
			my.pan -= 10 * time_step; 
		}
		if(vec_dist(my.x,target_ent.x) > 70)
		{
			c_move(my,vector(10 * time_step,0,0),nullvector,IGNORE_PASSABLE|GLIDE);
		}
		
		if (my.trace_hit2 && my.trace_hit1) my.pan=random(360);
		my.trace_hit1=0;
		my.trace_hit2=0;
		wait(1);
	}
}
////////////////////////////////////////////////////////////////////////////////////////
////////////////////////////////////////////////////////////////////////////////////////


Edit: works like a charm.
Edit2: with good oa i meant "not bad, good 4 basic"

Last edited by rayp; 08/29/13 01:47.

Acknex umgibt uns...zwischen Dir, mir, dem Stein dort...
"Hey Griswold ... where u gonna put a tree that big ?"
1998 i married my loved wife ... Sheeva from Mortal Kombat, not Evil-Lyn as might have been expected
rayp.flags |= UNTOUCHABLE;

Gamestudio download | 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