Gamestudio Links
Zorro Links
Newest Posts
AlpacaZorroPlugin v1.3.0 Released
by kzhao. 05/19/24 18:45
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, Ayumi, kzhao, 7th_zorro), 739 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
player movement (stairs) #386140
10/29/11 12:47
10/29/11 12:47
Joined: Jul 2005
Posts: 1,930
Austria
Dark_samurai Offline OP
Serious User
Dark_samurai  Offline OP
Serious User

Joined: Jul 2005
Posts: 1,930
Austria
Hi,

I'm having constantly problems to make a player script with good behavior when it comes to gravity and climbing stairs.

A simple ego perspective player script without any gravity:
Code:
function control_player()
{
   while(my.skill1 > 0)
   {
       VECTOR move_dist;
       move_dist.x = (key_w - key_s) * 15 * time_step;
       move_dist.y = (key_a - key_d) * 15 * time_step;
       move_dist.z = 0;
       
       c_move(my, move_dist, NULL, GLIDE + IGNORE_PASSABLE);

       my.pan -= MOUSE_SENSIBILITY * mouse_force.x * time_step;

       vec_set(camera.x, my.x);
       camera.z += EYE_HIGHT;
       camera.pan = my.pan;
       camera.tilt += MOUSE_SENSIBILITY * mouse_force.y * time_step;

       wait(1);
   }
}



Now I wanted to know how you are implementing a good gravity system that allows to walk on stairs? I know that there are many ways how this can be done and I know that there are many threads about this topic but I didn't managed to get a good result with any of the informations I got.

I don't want to use PhysX and I don't want to write my own collision system. All I want to use is c_move() and c_trace(). Additionally the code shouldn't be too complex (it's not important that the result is 100% perfect).

Thanks for sharing your experiences laugh


ANet - A stable and secure network plugin with multi-zone, unlimited players, voip, server-list features,... (for A7/A8)!
get free version
Re: player movement (stairs) [Re: Dark_samurai] #386143
10/29/11 13:51
10/29/11 13:51
Joined: Sep 2003
Posts: 5,900
Bielefeld, Germany
Pappenheimer Offline
Senior Expert
Pappenheimer  Offline
Senior Expert

Joined: Sep 2003
Posts: 5,900
Bielefeld, Germany
Did you try the example from the manual?
I'm not sure, but I remembered that it works quite well, and it should work with stairs as well, because it reflects how Jcl thinks it is supposed to be written...

Re: player movement (stairs) [Re: Dark_samurai] #386144
10/29/11 13:51
10/29/11 13:51
Joined: Dec 2008
Posts: 1,660
North America
Redeemer Offline
Serious User
Redeemer  Offline
Serious User

Joined: Dec 2008
Posts: 1,660
North America
More proof that the GS movement code sucks, eh?

Originally Posted By: Dark_samurai
I don't want to use PhysX and I don't want to write my own collision system. All I want to use is c_move() and c_trace(). Additionally the code shouldn't be too complex (it's not important that the result is 100% perfect).

c_move and c_trace are next to useless unless you place invisible walls over each and every non-flat surface and generally pamper the system into submission. No matter which way you look at it you will end up with a complex solution. Unlike Quake's AABB, which is very robust, even a slightly acute surface in Gamestudio can cause tremendous problems to its built-in movement system.

EDIT: @Pappenheimer: JCL's solution doesn't solve many problems and opens several cans of worms on its own.

Last edited by Redeemer; 10/29/11 13:53.

Eats commas for breakfast.

Play Barony: Cursed Edition!
Re: player movement (stairs) [Re: Redeemer] #386146
10/29/11 13:59
10/29/11 13:59
Joined: May 2009
Posts: 5,370
Caucasus
3run Offline
Senior Expert
3run  Offline
Senior Expert

Joined: May 2009
Posts: 5,370
Caucasus
First, make downwards trace with USE_BOX set on. Second, use "vec_for_min" to get the lower vertex of the players model, and use the vector which is returned by it, to get distance to ground:
Code:
my.height = my.z + min_vec.z - target.z;

After all done, you can pull player down and make smooth movement, something like this:
Code:
absdist.z = -(my.height - 17); // 17 is dist to ground
absdist.z = maxv( -35 * time_step, absdist.z); // 35 is falling speed

I hope, this was usefull for you.


Looking for free stuff?? Take a look here: http://badcom.at.ua
Support me on: https://boosty.to/3rung
Re: player movement (stairs) [Re: 3run] #386210
10/30/11 19:43
10/30/11 19:43
Joined: Jul 2005
Posts: 1,930
Austria
Dark_samurai Offline OP
Serious User
Dark_samurai  Offline OP
Serious User

Joined: Jul 2005
Posts: 1,930
Austria
Thank you all for your answers!

I haven't known that there is an example in the manual. I tried it and with some small improvements I really liked the result! The example works the same way as 3run described it.


ANet - A stable and secure network plugin with multi-zone, unlimited players, voip, server-list features,... (for A7/A8)!
get free version
Re: player movement (stairs) [Re: Dark_samurai] #386217
10/30/11 21:09
10/30/11 21:09
Joined: May 2009
Posts: 5,370
Caucasus
3run Offline
Senior Expert
3run  Offline
Senior Expert

Joined: May 2009
Posts: 5,370
Caucasus
There is an other example of a little bit more complex gravity, which I've made with Superku, take a look at AUM 100, but it's old. If you need me to, I can share with you updated version, just send me a PM.


Looking for free stuff?? Take a look here: http://badcom.at.ua
Support me on: https://boosty.to/3rung
Re: player movement (stairs) [Re: 3run] #386403
11/02/11 13:07
11/02/11 13:07
Joined: Jul 2005
Posts: 1,930
Austria
Dark_samurai Offline OP
Serious User
Dark_samurai  Offline OP
Serious User

Joined: Jul 2005
Posts: 1,930
Austria
Thx for the offer, but I think my current solution works already good enough. As I said before, it don't need to be perfect but simple.


ANet - A stable and secure network plugin with multi-zone, unlimited players, voip, server-list features,... (for A7/A8)!
get free version

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