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
3 registered members (TipmyPip, AndrewAMD, dBc), 18,430 guests, and 6 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
need script #306303
01/21/10 02:01
01/21/10 02:01
Joined: Nov 2009
Posts: 4
Indonesia
H
Hendro_Saputro Offline OP
Guest
Hendro_Saputro  Offline OP
Guest
H

Joined: Nov 2009
Posts: 4
Indonesia
is anyone know script code for sliding from slope height, if you character walk on mountain, he will slowly go down like sliding.
if the slope_height > 30// degress


-The Champion Never Quits-
Re: need script [Re: Hendro_Saputro] #306365
01/21/10 13:21
01/21/10 13:21
Joined: Sep 2003
Posts: 6,861
Kiel (Germany)
Superku Offline
Senior Expert
Superku  Offline
Senior Expert

Joined: Sep 2003
Posts: 6,861
Kiel (Germany)
Search for align to ground/ slope code in the forum. The following code aligns the model to the ground:

result = c_trace(my.x,vector(my.x,my.y,my.z-2000,IGNORE_ME | IGNORE_PASSABLE);
vec_rotate(normal,vector(-my.pan,0,0));
my.tilt = -asin(normal.x);
my.roll = -asin(normal.y);

Instead you can replace tilt and roll with a vector and check their orientation.


"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: need script [Re: Hendro_Saputro] #308640
02/04/10 04:54
02/04/10 04:54
Joined: Oct 2002
Posts: 2,256
Oz
L
Locoweed Offline
Expert
Locoweed  Offline
Expert
L

Joined: Oct 2002
Posts: 2,256
Oz
What you really want to do is add gravity to the absolute dist of c_move() and make sure the move_mode has GLIDE flag in it.

So here is C_Move parameters.
c_move(ENTITY* entity,VECTOR* reldist,VECTOR* absdist,var mode);

as simple example of a entity without any relative forces applied to it (key or mouse controls) that will slide down a slope, just do something like this.

// place an entity on a slope with this code on a slope and it should slide down slope (depending on how steep, gravity, and move_friction),
// adjust gravity and maybe change the engine variable move_friction
// if this doesn't work for you, things get more complicated
action WhateverAction()
{
VECTOR vGravity;
vec_set(vGravity,vector(0,0,-2.5*time_step)); // change -2.5 to more or less to get right gravity for your level scale
move_mode = IGNORE_SPRITES | IGNORE_PASSABLE | IGNORE_PASSENTS | GLIDE; // must have GLIDE to slip down slopes
while(1)
{
c_move(my,nullvector,vGravity,move_mode); // the nullvector would usually be your relative movement with mouse or key input
wait(1);
}
}

Hope it helps,
Loco


Professional A8.30
Spoils of War - East Coast Games

Moderated by  HeelX, Spirit 

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