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 / How do I make objects like buildings appear in different coordinates in a 3d world.

Author
Message
the desktops
21
Years of Service
User Offline
Joined: 9th Oct 2003
Location:
Posted: 17th Nov 2003 21:40
How do I make objects like buildings appear in different coordinates in a 3d world.

System3 Your video game software. The future of PC Video Gaming!
CattleRustler
Retired Moderator
21
Years of Service
User Offline
Joined: 8th Aug 2003
Location: case modding at overclock.net
Posted: 17th Nov 2003 21:45
you need to position (Position Objects commands-see dbp Help) the objects where you want them, then you can position/move the camera to wherever you like.

-RUST-
Mentor
22
Years of Service
User Offline
Joined: 27th Aug 2002
Location: United Kingdom
Posted: 17th Nov 2003 23:28
assuming a flat world and buildings with object numbers 1 to 800 (I use cubes here to simulate 800 buildings), all you need to do is something like this (the bit of code with the dreaded GOTO in it will be frowned on by purists, but I`m feeling lazy and its an easy way to avoid intersecting objects )

sync on:sync rate 0:hide mouse
make matrix 1,200,200,10,10
set matrix wireframe off 1
autocam off
position camera -4,0.2,-4
point camera 0,0.2,0
set camera range 0.001,300
for i=1 to 800
locate:
h#=(rnd(8)+1)/2
make object cube i,h#
position object i,rnd(200),h#/2,rnd(200)
turn object left i,rnd(360)
if object collision (i,0)>0
delete object i
goto locate
endif
next i
automatic camera collision 0,0.1,1
do
if upkey() then move camera 0.1
if leftkey() then turn camera left 1
if rightkey() then turn camera right 1
sync
loop

this makes a world with 800 objects in it that you can wander around amongst, the floor is flat but that can be easily fixed, I rotated the "buildings" for a bit of variety, hope thats some help.

Mentor.
John H
Retired Moderator
22
Years of Service
User Offline
Joined: 14th Oct 2002
Location: Burlington, VT
Posted: 18th Nov 2003 03:48
Very simply put....

Position Object Object Number, X Position, Y Position, Z Position


Dont forget to Join the Forums!

Login to post a reply

Server time is: 2024-11-25 18:02:10
Your offset time is: 2024-11-25 18:02:10