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.

3 Dimensional Chat / How do you indentify how steep a tile is in a matrix

Author
Message
Strife
21
Years of Service
User Offline
Joined: 11th Dec 2002
Location:
Posted: 14th Dec 2002 18:56
How do you indentify how steep a tile is in a matrix? Im trying to have my 3d Character to slide down a steep hill. I need to know how to do it with matrix and i dont think Get Ground Height helps with that either. Can anyone show me how to get a value out of how steep a matrix tile is?
rapscaLLion
21
Years of Service
User Offline
Joined: 29th Aug 2002
Location: Canada
Posted: 14th Dec 2002 19:03
sure, but it's a bit tricky, and the following is just a theory I've come up with, you'll have to figure out the specifics of how to do it:
find the height of the top of the slope (get ground height probably), then the height at the bottom of the slope.
Subtract the bottom from the top height, and you got the actual vertical distance between top and bottom. So picture a right angle triangle, and we just found its height. Then we have to find the horizontal distance between top and bottom, and then we have everything we need for some basic trigonometry:
Two sides and a 90 degree angle.

Then, the steepness of the slope is the angle of elevation from bottom to top, so we find that angle using trig:
Reverse Tangent on Vertical/Horizontal should give us that angle.

Understand?

Alex Wanuch
aka rapscaLLion
Kousen Dev Progress >> Currently Working On Editors
QuothTheRaven
21
Years of Service
User Offline
Joined: 2nd Oct 2002
Location: United States
Posted: 14th Dec 2002 19:47
erm...how exactly would you find the height of the bottom and top of a tile? How do you even know where they are positioned? And even if you did find the crazy slope, how would you tell if the object is trying to move up or down it? I dont think this would work.
Strife
21
Years of Service
User Offline
Joined: 11th Dec 2002
Location:
Posted: 14th Dec 2002 21:30
QuothTheRaven has a point is would be very difficult to figure out where the top and bottom of the slope is, thanx anyway.

rapscaLLion
21
Years of Service
User Offline
Joined: 29th Aug 2002
Location: Canada
Posted: 14th Dec 2002 23:32
First: If you have a better solution, I'm all ears.
Second: It can't be that hard to find the top and bottom of the slope. All you have to know is the highest point of a matrix tile, and the lowest point on a matrix tile. Subtract High from low and you got your OPP. Then you find the distance between the two and you've got your HYP. Use simple pythagorean calculations to get your ADJ, and you've got three sides and a 90 degree angle.
Then, using trig ratios you can find the angle of elevation, which is the angle you want.

The rest is up to your physics engine.

Alex Wanuch
aka rapscaLLion
Kousen Dev Progress >> Currently Working On Editors
Strife
21
Years of Service
User Offline
Joined: 11th Dec 2002
Location:
Posted: 14th Dec 2002 23:53
Im not saying the theory is bad(thats what i thought about doing the beginning). Its finding out what is the highest and lowest point of a tile. Actually there is a way to find the height of a tile but there is no way to find the lowest part of tile because the tile only has one value, you would have to check the tile next to it. But the problem with that is how would you know which way the slope is falling.

rapscaLLion
21
Years of Service
User Offline
Joined: 29th Aug 2002
Location: Canada
Posted: 15th Dec 2002 07:32
huh?

Ok, your using a matrix right? all the tiles are evenly spaced, so just get the height at all four corners of the tile, and if you wanted to be really accurate, get heights from the middle of the tile, and the middle of the edges, etc. Get ground height returns the height of the matrix at a certain point, not the average or maximum height of a tile...

Alex Wanuch
aka rapscaLLion
Kousen Dev Progress >> Currently Working On Editors
actarus
21
Years of Service
User Offline
Joined: 29th Aug 2002
Location: 32 Light Years away
Posted: 16th Dec 2002 02:34
Sounds logical.

Just remember that you're standing on a planet that's evolving
And revolving at nine hundred miles an hour!
The Wendigo
21
Years of Service
User Offline
Joined: 13th Sep 2002
Location: A hole near the base of a tree in the US
Posted: 23rd Dec 2002 00:31
OOOOOOH! MATH TIME! Get the slope of the 2 matrix tiles:

(y2-y1)/(x2-x1)

.(xy:5,8)
______
__/
.(xy:4,1)

Slope = (1-8)/(4-5)

If you want the absolute slope of all the tiles around it then you do that with all sides(S) and get their averages:

(S1+S2+S3+S4+S5+S6+S7+S8+S9)/9

you should be able to do this with any combination. Plus! I dont know if you need that angle, but you can use the ArchTangent (ATAN) to get that. There is an ATANFULL where you can pop in the difference of 2 sides and it will suposidly give you the angle (had some problems with it though). I know a fool proof (almost) way with ATAN, but it takes some work.

Hope that made sence, sorry if it didn't. Hard to explain things when you only have text to write with.

1.00 GHZ processor, 256 MB RAM, GeForce 3 64MB, SB Live!, 8 cans of soda per day
The Wendigo
21
Years of Service
User Offline
Joined: 13th Sep 2002
Location: A hole near the base of a tree in the US
Posted: 23rd Dec 2002 00:31
erk! my side view matrix didn't work

1.00 GHZ processor, 256 MB RAM, GeForce 3 64MB, SB Live!, 8 cans of soda per day

Login to post a reply

Server time is: 2024-03-29 07:33:24
Your offset time is: 2024-03-29 07:33:24