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.

DarkBASIC Discussion / How high is TOO high?

Author
Message
Scoober
22
Years of Service
User Offline
Joined: 21st Dec 2002
Location: United States
Posted: 21st May 2003 04:34
Ok.....made a halfway decent looking ice world-ish world (eheh) in Magic world (I dont really care for Mat Edit) and well...i kinda halfway used the DB tutorial 3rd person on a matrix...and changed it a bit......now what I really dont understand is how to make it to where My character cant go up certain slopes of the mountains surrounding the Ice Prison/castle thing world-ish world. How??!! I know you gotta set up the variables and all...but PLEASE someone make an example!!

Thanks In Advance!! Luh yall! sKy!
"Today is the tommorow we worried about yesterday"
Hell IVIonkey
22
Years of Service
User Offline
Joined: 1st Apr 2003
Location: Outer Limits
Posted: 21st May 2003 06:11
The correct way to do this is by getting the slope of the plane you're standing on. This can be done by getting the composite slopes in the XY axes and the ZY axes. Look up "partial derivatives" somewhere like Google.

Ag3ntSm1th
22
Years of Service
User Offline
Joined: 13th May 2003
Location:
Posted: 21st May 2003 09:34 Edited at: 21st May 2003 09:34
follow these easy steps:
1)make 4 dummy cubes
2)place each cube a certain amount (this amount depends on how big each matrix tile is, and how big your character is. youll see why) in front, back and to each side of your character and name them respectively. you must update these objects positions during movement to be in the same direction and the same distance from your character at all times.
3)now anytime you want your character to 'stop walking forward' : dz=get ground height(matrixnumber,dummyobjectXpositioninmatrix,dummyobjectZpositioninmatrix) and pz=(matrixnumber,playerXpositioninmatrix,playerZpositioninmatrix). if (dz-pz)=maxheightdifference then goto walkforward.
4)now if youdecide=0 then you are on flat ground, get it? the greater youdecide becomes, the higher the slope of the terrain is between you and the dummyobject in front of you. when the slope gets to the point of being too steep to walk, maxheightdifference will have been reached. get it?

If you are doing collision for a fast paced offroad type game (or anything to the likes), this will easily detect crashes against slopes on any side of the car so you could, say, trigger a subroutine to send the car into a horrible rolling crash or make a subroutine to decide a cars angle, trajectory, and amount the car flips in any direction while shooting off of a matrix based ramp.

hoe-lee sheet, mabye I should've just written a tutorial.
hope this helped

"The secret to creativity is knowing how to hide your sources." - Einstein
Hell IVIonkey
22
Years of Service
User Offline
Joined: 1st Apr 2003
Location: Outer Limits
Posted: 21st May 2003 11:17
Umm, it doesn't sound quite right to me.

Consider this: You see a hill of steepness 40 (lets say this is a pretty high unitless number). You walk up the hill straight on and are kicked back down because the steepness is 40. Walk up the hill at an angle almost perpendicular to straight up and the angle approaches 0. Here, you'll be able to inch your way up a hill of any steepness, even if it's virtually a 90-degree cliff wall.

Objects on 4 sides: Yes, this begins to tackle the "inch your way up any surface" problem. But, again, you'll be able to climb steeper hills facing one angle (like 45 degrees to the normal) than facing another (like 0, 90, 180, or 270 degrees to the normal).

Objects on 8 sides: this gets closer, but requires more calculations.
Objects on 360 sides: practically perfect, but requires a crapload of calculations.

Partial derivatives (easy since you are already given the component slopes): perfect AND very few calculations.

Scoober
22
Years of Service
User Offline
Joined: 21st Dec 2002
Location: United States
Posted: 21st May 2003 17:12
ok.......um.......but how do i do partial derivatives? I mean.....I really don't understand...sorri.....but another problem is when there is a big hole in the ground.....i want the character to go DOWN not WAAAAY up....

"Today is the tommorow we worried about yesterday"
actarus
22
Years of Service
User Offline
Joined: 29th Aug 2002
Location: 32 Light Years away
Posted: 22nd May 2003 00:04 Edited at: 22nd May 2003 00:04
-How high is TOO high

You can never be too high.

Running away You're lost for words again Now you`ve got all what you wanted Are you really satisfied?
Hell IVIonkey
22
Years of Service
User Offline
Joined: 1st Apr 2003
Location: Outer Limits
Posted: 22nd May 2003 01:45
Let's see. It would be easy to do this if you had the ability to get the normal. I've never tried this, so this is my best attmept. If somebody knows a more efficient way (using accurate math), post please!

Ok, on a matrix, all of your polygons will be either a perfect square or a square broken into 2 equilateral triangles. You need to determine the polygon that the player is standing on. This is a matter of diving the X & Y of the player by the size of a matrix tile, then taking into account any offsets. Once you know what tile you're on, find the highest slope of that polygon. This is done, I believe, by the following:

If it's a square:


If it's a triangle:


Yeah... little confusing. You'll probably always end up with the triangle scenario, so don't bother with the square one. Out of the 4 slopes you've found, find which one is the greatest. Then compare it to your "too steep" slope.

I may have done some extra calculations; maybe you don't need to do more than 2 slope tests... not really sure.

Ag3ntSm1th
22
Years of Service
User Offline
Joined: 13th May 2003
Location:
Posted: 22nd May 2003 03:41 Edited at: 22nd May 2003 03:51
i took some rereading, but i get what you mean with the problem in my method.
i also decided instead of using a stopwalkingforward approach, use a pushplayerback call that is triggered at the appropriate time.
to fix the "slow up any slope" problem:
maybe if you made a dummy object (limb) on the left and right side of the original dummy we made (the one in front of player). if the difference (in ggh(m,x,y)) between one of the left or right limbs and the original dummy object is too great, in addition to the original check for maxheightdifference, then pushplayerback()

i'll try to code it, but heed my ascii, i will get it to work. ;~)

<props> by the way, you do have merit to switch your name to thegreatpreemptivedebuggerguy at anytime. </props>

"The secret to creativity is knowing how to hide your sources." - Einstein
Hell IVIonkey
22
Years of Service
User Offline
Joined: 1st Apr 2003
Location: Outer Limits
Posted: 22nd May 2003 03:54
LOL

I preffer "SuperLordSexyFlyNuclearBadassGuy"

Oh, and you won't need to use objects for this.

Ag3ntSm1th
22
Years of Service
User Offline
Joined: 13th May 2003
Location:
Posted: 22nd May 2003 04:15
ok "SuperLordSexyFlyNuclearBadassGuy", you think it'll work?

"The secret to creativity is knowing how to hide your sources." - Einstein
Hell IVIonkey
22
Years of Service
User Offline
Joined: 1st Apr 2003
Location: Outer Limits
Posted: 22nd May 2003 08:29
Well, I don't really understand why you are using the objects. Any slope detection can be determined from just the player X and Y positions by finding the slopes of the face he's standing on (as described above in my ASCII diagram).

Pushplayerback is a better solution: what if you jump from a shallow hill onto the side of a steep hill. You need a way to slide down that hill, right?

Hell IVIonkey
22
Years of Service
User Offline
Joined: 1st Apr 2003
Location: Outer Limits
Posted: 22nd May 2003 11:24
I'd like to get my hands on the source from a 3d minigolf game in order to see the best way to calculate how plain-slope affects 3d motion when also considering friction.

Login to post a reply

Server time is: 2025-05-18 02:08:56
Your offset time is: 2025-05-18 02:08:56