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 / Need basic camera and collision help...

Author
Message
Fighter Bluestorm
19
Years of Service
User Offline
Joined: 2nd Aug 2005
Location:
Posted: 1st Jan 2006 00:53
My makeshift code has a bad problem with the camera it refuses to stay level with the key object also when the sphere collides with the boxes it jumps to the lower part of the box please some one help (the code should run without the need for downloading files) try it out to see what I mean...
[quote]
my E-mails is Fighter Infinity@aol.com

AL: "Big Brother I Have Too Pee!"
ED: "Your A Peice Of Freakin' Armor!"
Fighter Bluestorm
19
Years of Service
User Offline
Joined: 2nd Aug 2005
Location:
Posted: 2nd Jan 2006 01:56
sorry here is the code...


Rem Setup sync
Sync On
Sync Rate 30

Rem make matrix
Make matrix 1,10000,10000,20,20

rem Randomize the matrix
randomize matrix 1,125

Rem Make Cubes and place randomly
For x = 1 to 5
Make object cube x,100
Position object x,Rnd(2000),30,Rnd(2000)
Set object collision to boxes x
Next x

Rem Make sphere
Make object sphere 10,25
Position object 10,100,0,100
Set object collision to spheres 10

Rem Main loop
Do
Rem Store Object angle Y in aY#
aY# = Object angle Y(10)

X# = Object position x(10)
Z# = Object position z(10)
Y# = Get Ground Height(1,X#,Z#)

Position object 10,X#,Y#+12.5,Z#

CameraZ# = Newzvalue(Z#,AngleY#-180,100)
CameraX# = Newxvalue(X#,AngleY#-180,100)
CameraY# = Get Ground Height(1,CameraX#,CameraZ#)
Position camera CameraX#,CameraY#+50,CameraZ#

Point camera X#,Y#+25,Z#
Rem Control input for camera
If Upkey()=1 then Move object 10,10

If Leftkey()=1
Yrotate object 10,Wrapvalue(aY#-5)
Endif

If Rightkey()=1
Yrotate object 10,Wrapvalue(aY#+5)
Endif
If Downkey()=1 then Move object 10,-10

Rem Detect collision
If Object collision(10,0)>0
Position object 10,X#,0,Z#
Endif

Rem get player object position and store in X# and Z#
X# = Object position x(10)
Z# = Object position z(10)

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

Rem position camera
Position Camera cX#,75,cZ#

Rem point the camera at the player object
Point camera X#,25,Z#

Rem Refresh Screen
Sync

Loop

AL: "Big Brother I Have Too Pee!"
ED: "Your A Peice Of Freakin' Armor!"

Login to post a reply

Server time is: 2024-09-24 11:18:19
Your offset time is: 2024-09-24 11:18:19