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.

Newcomers DBPro Corner / restricting matrix movement in dBPro

Author
Message
Krimzon DestinE
19
Years of Service
User Offline
Joined: 18th Sep 2005
Location:
Posted: 16th Oct 2005 06:37
How can I restrict movement to a matrix? If I look down toward and press the forward key, I can travel downward through it, and if I look up and press forward, I can travel through the air without jumping. Also, I can venture off of the matrix into the "deep blue". How would you suggest I remedy it? I would rather you just type your response in plain old english instead of posting the code so that I can try to do something for myself first. Then, when I get stuck, you can post it. Thanks!!!

Lost in Thought
20
Years of Service
User Offline
Joined: 4th Feb 2004
Location: U.S.A. : Douglas, Georgia
Posted: 16th Oct 2005 11:24 Edited at: 16th Oct 2005 11:27
Well for the flying problem, either use the newxvalue and newzvalue for movement or always point your object/camera at xangle 0 before moving and put it back after moving and place your object at the matrix's ground height plus offset each loop. Or make a function to tilt your player with the terrain on the xangle and make him actually walk on the matrix.

For the traveling off the matrix into the deep blue problem just limit the players positions to the size of the matrix based on the matrix position. If the player goes too far then put him on the edge of the matrix.

I believe there are codes in the codebase/ code snippets forum showing all of this if you get stuck. Note it may say terrain instead of matrix but they are both very similar in principle.

TDK
Retired Moderator
21
Years of Service
User Offline
Joined: 19th Nov 2002
Location: UK
Posted: 17th Oct 2005 00:07
When you move either your player object or the camera - probably using the Move command - it is positioned along the three axis X, Y and Z. The second one, (Y), is the height off the ground.

So every time you move the player, just after using the Move command, use the Object Position X() and Object Position Z() functions to get the object's X and Z Position. (There are also equivalents for the camera).

Using these two values, you can use the Get Ground Height command to get the height of the matrix at that X/Z position. Then use the Position Camera/Object X,Y,Z command to reposition the player at the required Y height using the value returned from Get Ground Height and adding whatever you want the 'eye level' to be.

If the reposition is done before the Sync, it won't be seen.

TDK_Man

Krimzon DestinE
19
Years of Service
User Offline
Joined: 18th Sep 2005
Location:
Posted: 20th Oct 2005 03:41
alrighty, you're gonna have to show me the money with this one chief!!
RUCCUS
19
Years of Service
User Offline
Joined: 11th Dec 2004
Location: Canada
Posted: 20th Oct 2005 04:42
If this is with the tutorial code you've been using then go check out the site it's been updated with collision, it will solve your problem with going through the bottom of the matrix using one type of method, however you'll need to change the matrix to a plain so it may not be what you're looking for quite yet.

- RUCCUS

Krimzon DestinE
19
Years of Service
User Offline
Joined: 18th Sep 2005
Location:
Posted: 20th Oct 2005 05:09
Quote: "however you'll need to change the matrix to a plain so it may not be what you're looking for quite yet."


i really don't care what it is, as long as everything can move on it
PeaKnuckle
19
Years of Service
User Offline
Joined: 10th Nov 2004
Location:
Posted: 20th Oct 2005 08:15
Quote: "When you move either your player object or the camera - probably using the Move command - it is positioned along the three axis X, Y and Z. The second one, (Y), is the height off the ground.

So every time you move the player, just after using the Move command, use the Object Position X() and Object Position Z() functions to get the object's X and Z Position. (There are also equivalents for the camera).

Using these two values, you can use the Get Ground Height command to get the height of the matrix at that X/Z position. Then use the Position Camera/Object X,Y,Z command to reposition the player at the required Y height using the value returned from Get Ground Height and adding whatever you want the 'eye level' to be.

If the reposition is done before the Sync, it won't be seen.

TDK_Man "
Lost in Thought
20
Years of Service
User Offline
Joined: 4th Feb 2004
Location: U.S.A. : Douglas, Georgia
Posted: 20th Oct 2005 10:59 Edited at: 20th Oct 2005 11:00
Here is the money with comments.

[edit] I put all of my changes inside:

`****************
`****************

`****************
`****************



Krimzon DestinE
19
Years of Service
User Offline
Joined: 18th Sep 2005
Location:
Posted: 20th Oct 2005 23:08
damn... thanks!!!
Lost in Thought
20
Years of Service
User Offline
Joined: 4th Feb 2004
Location: U.S.A. : Douglas, Georgia
Posted: 21st Oct 2005 02:19
You're welcome and good luck. If you have any questions over what I did just ask, I was sleepier than I thought last night and didn't comment it as well as I thought.

Login to post a reply

Server time is: 2024-09-24 07:30:29
Your offset time is: 2024-09-24 07:30:29