Gamestudio Links
Zorro Links
Newest Posts
Newbie Questions
by AndrewAMD. 12/05/23 10:56
Zorro Trader GPT
by TipmyPip. 12/04/23 11:34
Square root rule
by Smallz. 12/02/23 09:15
RTest not found error
by TipmyPip. 12/01/23 21:43
neural function for Python to [Train]
by TipmyPip. 12/01/23 14:47
Xor Memory Problem.
by TipmyPip. 11/28/23 14:23
Training with command line parameters
by TipmyPip. 11/26/23 08:42
Combine USD & BTC Pairs In Asset Loop
by TipmyPip. 11/26/23 08:30
AUM Magazine
Latest Screens
A psychological thriller game
SHADOW (2014)
DEAD TASTE
Tactics of World War I
Who's Online Now
6 registered members (AndrewAMD, alibaba, fairtrader, ozgur, TipmyPip, Quad), 622 guests, and 1 spider.
Key: Admin, Global Mod, Mod
Newest Members
fairtrader, hus, Vurtis, Harry5, KelvinC
19019 Registered Users
Previous Thread
Next Thread
Print Thread
Rate Thread
Page 1 of 2 1 2
Gravity on Slopes #338549
08/18/10 23:28
08/18/10 23:28
Joined: Jul 2008
Posts: 168
8
82RJZAE Offline OP
Member
82RJZAE  Offline OP
Member
8

Joined: Jul 2008
Posts: 168
Hi, how might I code proper gravity for a player on slopes? How can I determine what the angle of the slope is in order to increase or decrease the z movement using a c_move instruction? Can anyone provide an example please?

Re: Gravity on Slopes [Re: 82RJZAE] #338558
08/19/10 06:39
08/19/10 06:39
Joined: May 2009
Posts: 5,367
Caucasus
3run Online
Senior Expert
3run  Online
Senior Expert

Joined: May 2009
Posts: 5,367
Caucasus
Look at my website in downloads, there is some player movement example with gravity and crawling. That might be useful for u.


Looking for free stuff?? Take a look here: http://badcom.at.ua
Support me on: https://boosty.to/3rung
Re: Gravity on Slopes [Re: 3run] #338714
08/20/10 20:26
08/20/10 20:26
Joined: Jul 2008
Posts: 168
8
82RJZAE Offline OP
Member
82RJZAE  Offline OP
Member
8

Joined: Jul 2008
Posts: 168
Thanks 3run, I found some of your code useful; however, I did not find any code related to gravity on slopes. I want to be able to make the player slide on steep slopes but I am unsure how I can detect the slope angle in order to determine the z speed to move the player down with. Any suggestions please?

Re: Gravity on Slopes [Re: 82RJZAE] #338715
08/20/10 20:47
08/20/10 20:47
Joined: Jul 2009
Posts: 1,198
Berlin, Germany
L
Liamissimo Offline
Serious User
Liamissimo  Offline
Serious User
L

Joined: Jul 2009
Posts: 1,198
Berlin, Germany
Use c_trace and then the normal extension. It gives you the angle of the traced block


"Ich weiss nicht genau, was Sie vorhaben, aber Sie können keine Triggerzonen durch Ihr Level kullern lassen."
-JCL, 2011
Re: Gravity on Slopes [Re: Liamissimo] #338718
08/20/10 21:27
08/20/10 21:27
Joined: Feb 2008
Posts: 3,232
Australia
EvilSOB Offline
Expert
EvilSOB  Offline
Expert

Joined: Feb 2008
Posts: 3,232
Australia
As BARE-BONES code
Code:
c_trace(from, to, USE_POLYGON);
if(trace_hit)  {  angle = acos(hit.nz);  }


where 'angle = 0' is flat ground, and 'angle = 90' is vertical wall.

Hope this helps.



"There is no fate but what WE make." - CEO Cyberdyne Systems Corp.
A8.30.5 Commercial
Re: Gravity on Slopes [Re: 82RJZAE] #338720
08/20/10 22:01
08/20/10 22:01
Joined: Aug 2009
Posts: 1,438
Spain
painkiller Offline
Serious User
painkiller  Offline
Serious User

Joined: Aug 2009
Posts: 1,438
Spain
Originally Posted By: 82RJZAE
Thanks 3run, I found some of your code useful; however, I did not find any code related to gravity on slopes. I want to be able to make the player slide on steep slopes but I am unsure how I can detect the slope angle in order to determine the z speed to move the player down with. Any suggestions please?


with the code from 3run you can slide through slopes without any other change on vertical speed, test it and you'll see. Also in the projects forum I've in the sci-fi shooter posted a demo for movement including also jumping and a test level so you can see it yourself.


3D Gamestudio A8 Pro
AMD FX 8350 4.00 Ghz
16GB RAM
Gigabyte GeForce GTX 960 4GB
Re: Gravity on Slopes [Re: Liamissimo] #339331
08/26/10 02:54
08/26/10 02:54
Joined: Jul 2008
Posts: 168
8
82RJZAE Offline OP
Member
82RJZAE  Offline OP
Member
8

Joined: Jul 2008
Posts: 168
I can use the normal extension to apply a gravity force to the player on slopes but this causes the player to not be able to overstep steps and ledges. Can anyone suggest a solution to this?

Re: Gravity on Slopes [Re: painkiller] #339699
08/28/10 18:37
08/28/10 18:37
Joined: Jul 2008
Posts: 168
8
82RJZAE Offline OP
Member
82RJZAE  Offline OP
Member
8

Joined: Jul 2008
Posts: 168
Can anyone help me with applying the gravity on slopes? 3run's nor painkiller's movement codes factor an application of gravity on slopes.

Re: Gravity on Slopes [Re: 82RJZAE] #339702
08/28/10 18:58
08/28/10 18:58
Joined: Aug 2009
Posts: 1,438
Spain
painkiller Offline
Serious User
painkiller  Offline
Serious User

Joined: Aug 2009
Posts: 1,438
Spain
we don't apply it because it isn't neccesary. but you can make a c_tace on front of the player to the ground and if the heught is bigger than the height of the gravity's c_trace, the you move up the enitity.

Last edited by painkiller; 08/28/10 18:58.

3D Gamestudio A8 Pro
AMD FX 8350 4.00 Ghz
16GB RAM
Gigabyte GeForce GTX 960 4GB
Re: Gravity on Slopes [Re: painkiller] #339706
08/28/10 19:13
08/28/10 19:13
Joined: Jul 2008
Posts: 168
8
82RJZAE Offline OP
Member
82RJZAE  Offline OP
Member
8

Joined: Jul 2008
Posts: 168
Originally Posted By: painkiller
we don't apply it because it isn't neccesary.

3run's movement code allows the player to run even up the steepest slopes. Wouldn't it be necessary to prevent that?

Originally Posted By: painkiller
but you can make a c_tace on front of the player to the ground and if the heught is bigger than the height of the gravity's c_trace, the you move up the enitity.

The player is not necessarily moving forward up slopes. He might be moving backwards or even strafing left or right.

Page 1 of 2 1 2

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