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 / camera goes through walls

Author
Message
Ryworks
17
Years of Service
User Offline
Joined: 25th Nov 2006
Location:
Posted: 14th Apr 2007 04:36 Edited at: 14th Apr 2007 04:38
Can some one help me with my camera problem. I rotate the camera around a ball and it goes through my levels walls.Is there a way so that it doesn't do that or it stops when the camera hits the wall.

this is the code i am using for my camera



ay#= object angle y(2)
X# = Object position x(1)
y# = OBJECT POSITION Y(1)
Z# = Object position z(1)

Rem get new camera position and store in cZ# and cX#
cZ# = Newzvalue(Z#,aY#-180,100+move*2)
cX# = Newxvalue(X#,aY#-180,100+move*2)


position camera cX#,object position y(1)+270-cmove/2,cZ#-500+cmove

Point camera X#,object position y(1),Z#

Download free games at my website at Ryworks Games
TDK
Retired Moderator
21
Years of Service
User Offline
Joined: 19th Nov 2002
Location: UK
Posted: 14th Apr 2007 05:41
Quote: "I rotate the camera around a ball and it goes through my levels walls."


If they are loaded and placed wall objects or DB primitives you could create an invisible cube at the camera's position and use the collision commands to stop the camera if the cube hits the wall.

TDK_Man

Ryworks
17
Years of Service
User Offline
Joined: 25th Nov 2006
Location:
Posted: 14th Apr 2007 20:28
ok i will try that but I never did that before so can you point me in the right direction with the coding. I heard the collision commands are hard to use.

Download free games at my website at Ryworks Games
TDK
Retired Moderator
21
Years of Service
User Offline
Joined: 19th Nov 2002
Location: UK
Posted: 14th Apr 2007 23:37 Edited at: 14th Apr 2007 23:38
Your camera is positioned using variables. If you create a cube of size 5 and place it at the same position as the camera, you effectively place the camera inside the cube.

Unless you alter the cull setting of the cube, the insides of the cube will not be drawn and it will therefore be invisible to the camera.

Every time you move the camera, use the same X,Y,Z position variables to position the cube on the very next line.

As for collision, all you need is very basic collision. As you didn't respond to my comment about exactly what your walls are made from, it's impossible to be any more specific. There's a tutorial on basic collision here:

http://forum.thegamecreators.com/?m=forum_view&t=99497&b=10

Check out tutorial number 10. I know they are for DBC, but this applies to DBP's collision commands too.

TDK_Man

Ryworks
17
Years of Service
User Offline
Joined: 25th Nov 2006
Location:
Posted: 15th Apr 2007 00:46 Edited at: 15th Apr 2007 00:48
Sorry about that. The walls are loaded in X format (walls.x). Thanks for your help

The link you gave me number 10 tutorial doesn't work it sends me to a blank post thought you might want to know.

Download free games at my website at Ryworks Games
TDK
Retired Moderator
21
Years of Service
User Offline
Joined: 19th Nov 2002
Location: UK
Posted: 15th Apr 2007 01:38 Edited at: 15th Apr 2007 08:34
Quote: "it sends me to a blank post thought you might want to know."


Oops - yes I forgot about that! Doh!

The post was moved and I forgot to update the links. Here you go...

http://forum.thegamecreators.com/?m=forum_view&t=96045&b=10

Loaded .X files should work the same as DB primitives as far as the tutorial goes. Just post back here if you have any problems.

TDK_Man

Ryworks
17
Years of Service
User Offline
Joined: 25th Nov 2006
Location:
Posted: 15th Apr 2007 06:14
thank you this helped a lot I really appreciated it.

Download free games at my website at Ryworks Games

Login to post a reply

Server time is: 2024-09-25 21:28:14
Your offset time is: 2024-09-25 21:28:14