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
2 registered members (OptimusPrime, AndrewAMD), 14,580 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
Terrain Follow #210977
06/14/08 09:10
06/14/08 09:10
Joined: May 2007
Posts: 185
Netherlands
SurudoiRyu Offline OP
Member
SurudoiRyu  Offline OP
Member

Joined: May 2007
Posts: 185
Netherlands
Hi im trying to let me units follow the terrain.
It work's right now but it works ugly frown

They are sort of jumping arround when they follow the terrain up or down >.<

How to fix this ?

Here is my code of it:

Code:
	while(me!=NULL) 
	{
		//trace floor
		vec_set(trace_from,my.x);
		vec_set(trace_to,my.x);
		trace_to.z -= 500;
		ground_dist = c_trace(trace_from,trace_to,ignore_me|ignore_passents|ignore_passable|ignore_sprites|use_box);
		
		if(ground_dist != 0)
		{
			my.z -= ground_dist;
	   }
 



-The Dragon's Eye is alway's watching you!-
Re: Terrain Follow [Re: SurudoiRyu] #210990
06/14/08 10:45
06/14/08 10:45
Joined: May 2006
Posts: 90
England
TigerTao Offline
Junior Member
TigerTao  Offline
Junior Member

Joined: May 2006
Posts: 90
England
I remember someone saying its best to call a floor trace twice, once before c_move and then once again after c_move

Not sure why but does seem to work. Perhaps it is something to do with changing a z position directly does not perform collision detection as it does when using c_move or ent_move.

Call trace to move enemy up on terrain if result is not 0

Move player forwards into terrain (c_move)

Call trace again to move enemy up on terrain after moving forward.




Last edited by TigerTao; 06/14/08 10:48.
Re: Terrain Follow [Re: TigerTao] #211034
06/14/08 15:06
06/14/08 15:06
Joined: May 2007
Posts: 185
Netherlands
SurudoiRyu Offline OP
Member
SurudoiRyu  Offline OP
Member

Joined: May 2007
Posts: 185
Netherlands
thnx, it helped for the movement problem but now sometimes it moves on a certain area very slow or not at all :S kinda weird but ill try to fix this problem smile


-The Dragon's Eye is alway's watching you!-
Re: Terrain Follow [Re: SurudoiRyu] #211046
06/14/08 16:20
06/14/08 16:20
Joined: Sep 2003
Posts: 929
Spirit Offline

Moderator
Spirit  Offline

Moderator

Joined: Sep 2003
Posts: 929
The online manual has got a ground walking example recently, click on the "Manual" link and then scroll down and click on "c_move".


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