Gamestudio Links
Zorro Links
Newest Posts
Free Live Data for Zorro with Paper Trading?
by AbrahamR. 05/18/24 05:41
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
2 registered members (AbrahamR, AndrewAMD), 1,278 guests, and 2 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
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 | 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