Sorry your browser is not supported!

You are using an outdated browser that does not support modern web technologies, in order to use this site please update to a new browser.

Browsers supported include Chrome, FireFox, Safari, Opera, Internet Explorer 10+ or Microsoft Edge.

Dark GDK / Terrain Slope affecting speed?

Author
Message
Zuka
16
Years of Service
User Offline
Joined: 21st Apr 2008
Location: They locked me in the insane asylum.
Posted: 27th Apr 2008 07:40
I was thinking about this. You know, in the terrain demo, when you go up a mountain, you go really fast? Not realistic at all, right?

Does anyone know a way I could slow you down based on the slope?

I was thinking something like this:


//pseudo code, of course
if thisHeight < heightNextToMe || thisHeight > heightNextToMe
slow down player by thisHeight - heightNextToMe

I AM THE ALL MIGHTY CORNHOLIO! Do you have TP for my bunghole?
Zuka
16
Years of Service
User Offline
Joined: 21st Apr 2008
Location: They locked me in the insane asylum.
Posted: 27th Apr 2008 07:41
Also, how do I 'stick' stuff to terrain? You know, like, if you have a tank. You don't want it level on the side of a hill, right? How do I do that? Let physics and collision do it?

I AM THE ALL MIGHTY CORNHOLIO! Do you have TP for my bunghole?
jason p sage
17
Years of Service
User Offline
Joined: 10th Jun 2007
Location: Ellington, CT USA
Posted: 27th Apr 2008 22:33
Question 1:
Quote: "I was thinking about this. You know, in the terrain demo, when you go up a mountain, you go really fast? Not realistic at all, right?"


Think about what's happening a second. You have your charater moving FORWARD at a particular speed. The the computer is likely lauching your player to the current hill height... giving ILLUSION you are going faster. YOU AREN'T! .... but it does look that way... so how do we fix it? Your way? VERY KLUDEGY. Why? Because if nothing is done to account for the angle of the hill, now you have 2 speeds... flat land and NOT-FLATLAND.

To REALLY fix, either do major math to get the speed/angle correct or ... My Preference... Simple "Angle" the player (or a hidden object) to the hill... point in correct direction to travel, the dbMoveObject(id,dist). Then readjust to new position - meaning reorient player to hill.... like you asked about in....

Question 2:
Quote: "Also, how do I 'stick' stuff to terrain? You know, like, if you have a tank. You don't want it level on the side of a hill, right? How do I do that? Let physics and collision do it?"
I almost ruined an LCD monitor trying to get the scotch tape off, so trust me that one doesn't work! There are a few ways... Loose placement? Put in the air, and "DROP" onto terrain, letting the collision pick up when it hits the ground. So - to answer your question - physics would do al of it in this scenario... though I just mentioned a decent sparky collision trick... Physics you need to be a little more careful, as things will bounce, roll when you try the DROP from the Sky technique.

Now you sound like your talking about making a TANK appear on the hill correctly... Like as you drive up a hill. Well, I had to ask like you, and someone gave me a code snip. Here is one, I WROTE using it, and this is dbpro, but hopefully you can study it and do like I did, study, try, break, try, GOT IT eventually LOL..


Login to post a reply

Server time is: 2024-09-29 19:26:06
Your offset time is: 2024-09-29 19:26:06