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 / DBPro Matrix Help

Author
Message
Falelorn
21
Years of Service
User Offline
Joined: 19th Jun 2003
Location: Canada
Posted: 15th Aug 2003 22:41
When I create a matrix, and run around it, I can climb hills that are any angle, and if I go to far at the edge it leaves the matrix into the "blue zone".

How can I stop this? I dont want to climb the high angle hills and want to stop the camera, aka character from leaving the matrix. I can have hills at the edges of the matrix.
Falelorn
21
Years of Service
User Offline
Joined: 19th Jun 2003
Location: Canada
Posted: 16th Aug 2003 10:04
Ok **UPDATE**

I tried "matrix collision" by camera position stopping the camera, but doesnt work.

I tried the http://www.darkbasic.com/create/bm_tutorials/3dgame/lesson_06.htm
tutorial, but no help.

BTW im using Matedit to create the matrix for pro, if that helps. Im also using (for now) the mouse click move that came with Matedit.
the_winch
21
Years of Service
User Offline
Joined: 1st Feb 2003
Location: Oxford, UK
Posted: 16th Aug 2003 23:57
Are the high angled hills defined by angle or height?

If they are defined by height (edge hill are higher than all others) then you can tell if you camera is at the foot of an edge hill by checking the ground height at camera x + 1 / camera x - 1 /camera z + 1 / camera z - 1. If the height is above a cetain height then stop the camera from moving in that direction. You will need to experiment with the distance from the camera you use for "get ground height".

If they are defined by angle (edge hill are steeper than others) its a bit more complicated. You need to get 2 heights from each direction (x+1 x+2 / x-1 x-2 / z+1 z+2/ z-1 z-2) and work out the angle between the 2 heights for each direction. If the angle is say above 45 then you know its a steep hill and it must be the edge.

You could also use camera position and stop it moveing when it gets past a certain value. Use the text command to put values you will need on the screen, like text0,0,str$(camera position x) to find what x position to stop the camera.
Falelorn
21
Years of Service
User Offline
Joined: 19th Jun 2003
Location: Canada
Posted: 17th Aug 2003 01:46
Heres the code im using.

I tried to stop the camera at X 10 Z 10 X 49900 Z 49900 (Matrix is 50k by 50k)

now im going nuts. Ive tried everything I can think of.

Any help would be appriciated.
Falelorn
21
Years of Service
User Offline
Joined: 19th Jun 2003
Location: Canada
Posted: 21st Aug 2003 10:22
bump

This is driving me crazy.

Any help would be greatly appreciated.
ReD_eYe
21
Years of Service
User Offline
Joined: 9th Mar 2003
Location: United Kingdom
Posted: 21st Aug 2003 17:55
i'll do you an example shortly, just got back from hols, from what i've gathered you just don't want to be able to walk off the edge of your matrix?

I have a website!!!
So go there: http://www.freewebs.com/darkb/index.htm
on second thought you probably shouldn't
GameKit
21
Years of Service
User Offline
Joined: 6th Mar 2003
Location: USA, Staring Blankly at a Computer
Posted: 21st Aug 2003 17:57
for stoping the camera at the edge of the matrix, try this...



just put this code somwhere in your main loop... this should make the camera not be able to leave the matrix... well... i hope that helps...

Anyone Can Destroy...But Few Can Create...
GameKit
21
Years of Service
User Offline
Joined: 6th Mar 2003
Location: USA, Staring Blankly at a Computer
Posted: 21st Aug 2003 18:15
also... to make sure the camera can't go up too steep of slopes... try this bit of code at the beggining of your loop...



and then put this code near the end of your loop...



This code is untested but i think it will work... just replace the [max height differance] with any number above 0...well...once again...i hope that helps...

Anyone Can Destroy...But Few Can Create...
ReD_eYe
21
Years of Service
User Offline
Joined: 9th Mar 2003
Location: United Kingdom
Posted: 21st Aug 2003 18:36
the way i would do the second part is to use newxvalue and newzvalue to find the matrix height just ahead of you and then compare it to your current matrix height.

I have a website!!!
So go there: http://www.freewebs.com/darkb/index.htm
on second thought you probably shouldn't
David T
Retired Moderator
22
Years of Service
User Offline
Joined: 27th Aug 2002
Location: England
Posted: 21st Aug 2003 22:33
What you do (and I think this has been mentioned) is place an object in front of your player. Position that on the ground and get the difference in Y value between the two heights. Add that to the player movement speed, so eventually after some tweaking your player should not be able to go up hils, and may even slide back down steep ones when stopped on a slope.

It works well for car games.

There's no place like 127.0.0.1

There are 10 people in this world, those who understand binary and those who don't.
Falelorn
21
Years of Service
User Offline
Joined: 19th Jun 2003
Location: Canada
Posted: 22nd Aug 2003 03:06
Thanks for the help, got it working.

Im playing with collision now for objects (.x models), having a few problems, but searching through the snips.

Thanks again.

Login to post a reply

Server time is: 2024-09-20 19:47:34
Your offset time is: 2024-09-20 19:47:34