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
4 registered members (AndrewAMD, ozgur, AbrahamR, wdlmaster), 849 guests, and 7 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
c_trace issue #283160
08/06/09 07:47
08/06/09 07:47
Joined: Jul 2008
Posts: 553
Singapore
delinkx Offline OP
User
delinkx  Offline OP
User

Joined: Jul 2008
Posts: 553
Singapore
hi,

i am trying to make my entity scan a step and move over it. see the image:



i trace once(trace1) from (min_x,min_y,min_z) to (min_x+10, min_y, min_z)

2nd trace(trace2) is from (min_x,min_y, min_z) to (min_x+10, min_y, min_z+100)

the entity will go up (my.z = my.z+100) if trace 1 > 0 and trace2 = 0;

but my traces giving me values of zero for all.

here my code:
Code:
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, vector(7 * time_step, 0, 0), nullvector, GLIDE);

	trace1 = c_trace(vector(my.min_x,my.min_y,my.min_z), vector(my.min_x+10,my.min_y,my.min_z), IGNORE_SPRITES);
	trace2 = c_trace(vector(my.min_x,my.min_y,my.min_z), vector(my.min_x+10,my.min_y,my.min_z+100), IGNORE_SPRITES);
	
	if(trace1 > 0 && trace2 = 0)
		my.z += 100;
	


	

		
		//walk animation sequence
		ent_animate(me,"walk",walk_percentage, ANM_CYCLE);
			
		
	
		walk_percentage += 4 * time_step;
		wait(1);
	}
}



my above test case involves an empty room. few cubes placed around on the floor.


A7 commercial Team / VC++ 2008 Pro
homepage | twitter | facebook
Re: c_trace issue [Re: delinkx] #283168
08/06/09 08:30
08/06/09 08:30
Joined: Jul 2008
Posts: 553
Singapore
delinkx Offline OP
User
delinkx  Offline OP
User

Joined: Jul 2008
Posts: 553
Singapore
ok. while experimenting. i realise that my.min_x, etc are local cordinates. i updated my code to use this:

Code:
c_move (my, vector(7 * time_step, 0, 0), nullvector, GLIDE);

trace1 = c_trace(vector(my.x,my.y,my.z), vector(my.x+20,my.y,my.z), USE_BOX);
trace2 = c_trace(vector(my.x,my.y,my.z), vector(my.x+20,my.y,my.z+100), USE_BOX);
	
	if(trace1 > 0 && trace2 = 0)
		my.z += 100;



Now wat happens, is few entities keep sliding along the steps and after a few tries it moves up (z+100). some still cant go, they keep sliding along the steps.


A7 commercial Team / VC++ 2008 Pro
homepage | twitter | facebook
Re: c_trace issue [Re: delinkx] #283217
08/06/09 15:31
08/06/09 15:31
Joined: Jun 2006
Posts: 2,640
Earth
Germanunkol Offline
Expert
Germanunkol  Offline
Expert

Joined: Jun 2006
Posts: 2,640
Earth
try adding IGNORE_CONTENT in the c_trace


~"I never let school interfere with my education"~
-Mark Twain
Re: c_trace issue [Re: Germanunkol] #283307
08/07/09 02:45
08/07/09 02:45
Joined: Jul 2008
Posts: 553
Singapore
delinkx Offline OP
User
delinkx  Offline OP
User

Joined: Jul 2008
Posts: 553
Singapore
does not help.. they still behave same. y is it so troublesome to make an automated entity climb up and down. i tried the staircase codes as well. nothing works. so i did as above to trace and move them but still no success.


A7 commercial Team / VC++ 2008 Pro
homepage | twitter | facebook
Re: c_trace issue [Re: delinkx] #283320
08/07/09 07:26
08/07/09 07:26
Joined: Jun 2006
Posts: 2,640
Earth
Germanunkol Offline
Expert
Germanunkol  Offline
Expert

Joined: Jun 2006
Posts: 2,640
Earth
well, you know about GLIDE, do you?
If the entity origin is in the middle of the model (which it should be. Open it in MED and move the model until the origin is right in his stomach somewhere) then using c_move with GLIDE as a mode lets the entity move up stairs. Sounds like a simpler method.


~"I never let school interfere with my education"~
-Mark Twain
Re: c_trace issue [Re: Germanunkol] #283498
08/08/09 00:53
08/08/09 00:53
Joined: Jan 2002
Posts: 300
Usa
Rich Offline
Senior Member
Rich  Offline
Senior Member

Joined: Jan 2002
Posts: 300
Usa
I usually handle this in my gravity code. I place the origin in the center of my model, and then trace from its origin to about 2-3 quants below its min_z value. If the result of the trace ends within the model, I move the model up. Heres an image, hope that helps in some way.



Re: c_trace issue [Re: Rich] #283522
08/08/09 09:19
08/08/09 09:19
Joined: Jun 2006
Posts: 2,640
Earth
Germanunkol Offline
Expert
Germanunkol  Offline
Expert

Joined: Jun 2006
Posts: 2,640
Earth
Hm. This code placing the entity onto the ground may stop it from moving up the steps. Try commenting it out and place a "-1*time_step" into the c_move function for the absolute z value. example:

vec_set(temp,vector(my_moveSpeed*time_step,my_strafe*time_step,0));

c_move(my,temp,vector(0,0,-time_step),GLIDE); //glide is important

Just for testing purpose. And comment out all of this:
trace1 = c_trace(vector(my.x,my.y,my.z), vector(my.x+20,my.y,my.z), USE_BOX);
trace2 = c_trace(vector(my.x,my.y,my.z), vector(my.x+20,my.y,my.z+100), USE_BOX);

if(trace1 > 0 && trace2 = 0)
my.z += 100;

just to make sure it works this way, then you can go from there...?

Edit: and if it still doesn't work, try replacing the vector(0,0,-time_step) with "nullvector" again.

Last edited by Germanunkol; 08/08/09 09:19.

~"I never let school interfere with my education"~
-Mark Twain
Re: c_trace issue [Re: Germanunkol] #283981
08/11/09 02:42
08/11/09 02:42
Joined: Jul 2008
Posts: 553
Singapore
delinkx Offline OP
User
delinkx  Offline OP
User

Joined: Jul 2008
Posts: 553
Singapore
Thnx all. Now i get the entity to move up the stairs. Both methods works:

1. Putting the entity's origin at its body center.
2. and the method of Germanunkol using-1*time_step.

But now, if i put the code to put back the entities to the ground it stops climbing up. with both methods.

here is the rectified code:

Code:
c_move (my, vector(7 * time_step, 0, 0), nullvector, GLIDE);

	trace1 = c_trace(vector(my.x,my.y,my.z), vector(my.x+20,my.y,my.z), IGNORE_CONTENT);
	trace2 = c_trace(vector(my.x,my.y,my.z), vector(my.x+20,my.y,my.z+100), IGNORE_CONTENT);
	
	if(trace1 > 0 && trace2 = 0)
		my.z += 100;
	

	//keeping entity on ground
	c_trace(my.x,vector(my.x,my.y,my.z-1000),IGNORE_ME|IGNORE_SPRITES|IGNORE_CONTENT);
	my.z = hit.z - my.min_z;



if i remove the code for keeping entity on ground, then it can climb. with that it doesnt. even if i use the method by Germanunkol.


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