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
Data from CSV not parsed correctly
by jcl. 04/26/24 11:18
Why Zorro supports up to 72 cores?
by jcl. 04/26/24 11:09
AUM Magazine
Latest Screens
The Bible Game
A psychological thriller game
SHADOW (2014)
DEAD TASTE
Who's Online Now
4 registered members (AndrewAMD, 7th_zorro, VoroneTZ, Quad), 901 guests, and 0 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
problem with stairs and random walk #282986
08/05/09 04:07
08/05/09 04:07
Joined: Jul 2008
Posts: 553
Singapore
delinkx Offline OP
User
delinkx  Offline OP
User

Joined: Jul 2008
Posts: 553
Singapore
hello,

i am making my characters walk randomly in an empty room. if there is a stair they need go over it and step down if required (i.e. their feet always clamped to ground).

i have managed to do tat, but then i want when 2 entities hit each other, they pan randomly and continue their motion. when i use trace_hit, then the entity doesnt climb the stairs. it finds it as a obstacle. I tried all the stair case examples i could find in the forum but doesnt work.

here is the code:

Code:
///////////////////////////////
//includes
#include <acknex.h> 	//contains all the predefined structures
#include <default.c> //mouse and controls predefined
//#include "mtlFX.c" 	//material & shaders
///////////////////////////////

//global variables
STRING* strLevel = "Gtest.WMB";
STRING* strModel = "agent.MDL";
ENTITY* entAgent[1000];
var run_percentage;
var agent_count = 0;
var mygravity;
int no_of_agents = 100;



//action for walk animation of entity
action entity_walk()
{
	var walk_percentage;
	var move_result;
	var pan_count = 0;
	
	var speed_down = 0;
	VECTOR vFeet;
	vec_for_min(vFeet,me);
	
	wait(1);
	while(1)
	{
		pan_count = 0;


	c_move (my, nullvector, vector(0,0,10), IGNORE_PASSABLE);
	c_move (my, vector(7 * time_step, 0, 0), nullvector, IGNORE_PASSABLE);
	c_move (my, nullvector, vector(0,0,-10), IGNORE_PASSABLE);


	

		
		//walk animation sequence
		ent_animate(me,"walk",walk_percentage, ANM_CYCLE);
			//collision detection and resolution
		
		
		if (event_type == EVENT_ENTITY)
		{
			me.pan = random(360);
			pan_count += 1;
			wait(1);
		}
	
		
//	
//		if(trace_hit != 0) 
//		{
//			
//			me.pan = random(360);
//			pan_count += 1;
//			wait(1);
//	
//		}
//		
		walk_percentage += 4 * time_step;
		wait(1);
	}
}


//funtion to load entities
function load_entity()
{
	randomize();
	var ran_pos_x, ran_pos_y;
	var i, j;
	
	
	for(i=0; i<no_of_agents; i++)
	{
	wait(1);
	ran_pos_x = random(3000)-1710;
	ran_pos_y = random(3000)-1642;
	
	
	
	
	
	
	//create entity
	entAgent[i] = ent_create(strModel, vector(ran_pos_x,ran_pos_y,-240), entity_walk);
	
	
	agent_count +=1; 
	
		
	//scale entity
	entAgent[i].scale_x = 2;
	entAgent[i].scale_y = 2;
	entAgent[i].scale_z = 2;
	entAgent[i].pan = random(360);
	//setting bounding box to tight fit for better collision detection0 
	//wait(1);
	c_setminmax(entAgent[i]);
	//set shadows on
	set(entAgent[i], SHADOW);
	   
	
	  
	}	
	
	
}

//main function
function main()
{
	//800x600 screen resolution
	video_mode = 6;
	//1-fullscreen, 2-window mode
	video_screen = 2;
	//mouse mode
	mouse_mode = 1;
	max_entities = 1000;
	//loading level
	level_load(strLevel);
	wait(2);
	//call function to create agent
	load_entity();
}



The level is an empty room with 4 walls and cubes placed around for the entities to walk over it and step down back 2 ground.


A7 commercial Team / VC++ 2008 Pro
homepage | twitter | facebook
Re: problem with stairs and random walk [Re: delinkx] #282987
08/05/09 04:22
08/05/09 04:22
Joined: Aug 2008
Posts: 482
B
bart_the_13th Offline
Senior Member
bart_the_13th  Offline
Senior Member
B

Joined: Aug 2008
Posts: 482
Create invisible block that serves as a ramp, then set the visible ramp as passable...
Hope it helps...

Re: problem with stairs and random walk [Re: bart_the_13th] #282990
08/05/09 05:30
08/05/09 05:30
Joined: Jul 2008
Posts: 553
Singapore
delinkx Offline OP
User
delinkx  Offline OP
User

Joined: Jul 2008
Posts: 553
Singapore
is there no other options apart from modifying the design. my terrain is quite complex. if there is a script solution, that would be better.


A7 commercial Team / VC++ 2008 Pro
homepage | twitter | facebook
Re: problem with stairs and random walk [Re: delinkx] #283143
08/05/09 23:08
08/05/09 23:08
Joined: Oct 2006
Posts: 175
G
Gumby22don Offline
Member
Gumby22don  Offline
Member
G

Joined: Oct 2006
Posts: 175
you could try setting it up to c_trace from my.x,my.y,my.z+step_height instead of from my.x, my.y, my.z - this way it checks if movement is possible at the top of a normal step, instead of hitting the base of it.

Don
have a great day

Re: problem with stairs and random walk [Re: Gumby22don] #283161
08/06/09 07:48
08/06/09 07:48
Joined: Jul 2008
Posts: 553
Singapore
delinkx Offline OP
User
delinkx  Offline OP
User

Joined: Jul 2008
Posts: 553
Singapore


A7 commercial Team / VC++ 2008 Pro
homepage | twitter | facebook

Moderated by  HeelX, Lukas, rayp, Rei_Ayanami, Superku, Tobias, TWO, VeT 

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