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 / making walls and wall collisions

Author
Message
bigfish58
20
Years of Service
User Offline
Joined: 25th Dec 2004
Location:
Posted: 26th Dec 2004 04:12
hi

i have the following code



as you know its a basic 3rd person camera, with a basic terain, but the funny thing is you can walk off the sides lollll, can some one edit the code so it has 4 walls surrounding the terain and also so that you dont walk onto empty space

cheers

email me the code at: [email protected]
Jess T
Retired Moderator
21
Years of Service
User Offline
Joined: 20th Sep 2003
Location: Over There... Kablam!
Posted: 26th Dec 2004 08:41
All you wanna do is get the matrix position, it's width/depth, then do a check to see if the 'player' is further away from the centre than half of the width/depth ( ie, off the edge )

something like:
wid = Matrix Width
dep = Matrix Depth

If player x position < Matrix x position - ( wid /2 ) Or > Matrix x position + ( wid /2 )
Position Player at last coordinates
EndIf
If player z position < Matrix z position - ( dep /2 ) Or > Matrix z position + ( dep /2 )
Position Player at last coordinates
EndIf


Of course, that wont compile, but that's the basic way to do it

Have a look in the help files for the relevant commands.

Jess.


Team EOD :: Programmer/All-Round Nice Guy
Aust. Convention!

Login to post a reply

Server time is: 2025-05-24 07:33:16
Your offset time is: 2025-05-24 07:33:16