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 / rotating a matrix

Author
Message
Wikaman1
16
Years of Service
User Offline
Joined: 17th Aug 2008
Location: Scotland
Posted: 23rd Nov 2008 16:39
I'm trying to get my charactr for my game to walk up a set of stairs. I thought I would make a matrix and lay it over the stairs but I cant seem to be able to rotate the matrix because I cant see a command that lets you do it. Is there another way to do it?
sydbod
16
Years of Service
User Offline
Joined: 14th Jun 2008
Location: Just look at the picture
Posted: 24th Nov 2008 00:44 Edited at: 24th Nov 2008 00:53
void dbSetMatrixHeight ( int MatrixNumber, int Tilex, int Tilez, float Height )

With this function you can adjust the height of any node in the matrix.

Within 2 loops ( x loop, z loop) adjust you matrix nodes into a ramp.

With the right code you can make the ramp slope in any directional angle.

The only problem will be at the top of your stairs if they are not rising in purely an X or Z direction, because you will have a corner lip of the matrix rising above the top of the stairs height. This may cause the character to appear to do a small jump at the top of the stairs.
Pillarofire
20
Years of Service
User Offline
Joined: 31st Dec 2003
Location: Good Question, <looks around.>
Posted: 25th Nov 2008 04:16
Are the stairs Objects? If it were me, I'd do something like:



As you can see from the code, the basic idea is to start a line from where you want the character to go next, up half of the lines height and extend it down half of its height. If the line intersects a polygon of your stair object, then the IntersectObject function will return a distance value; the distance from where the line began, to the point of intersection on the object. Thus you simply have to place your character at the start of the line minus the length of the collision.

Of course this would only calculate the ground collision, but with a little work the same concept could be implemented with collisions is any direction.

Login to post a reply

Server time is: 2024-09-30 11:22:37
Your offset time is: 2024-09-30 11:22:37