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.

Code Snippets / [DBPro]Skymatter Skybox

Author
Message
Lama
18
Years of Service
User Offline
Joined: 15th Jul 2007
Location:
Posted: 15th Jul 2007 12:01
Heres some code I put together from other users on the forums. it should give you a basic start for using your skyboxes. you only need to edit the path to your skybox images.


set camera range 100,30000


`set path to files and skybox size
Dir$="C:\path\to\skymatter\picture\files\"
Size#=24000
Sobj=1

`Change these to "create bitmap" and such if you wish to generate your own images. Image Numbers are in the 500's. MAke sure they haven't been used.
`LOAD IMAGES
load image Dir$+"/Pos_z.bmp",500
load image Dir$+"/Neg_z.bmp",501
load image Dir$+"/Pos_x.bmp",502
load image Dir$+"/Neg_x.bmp",503
load image Dir$+"/Pos_y.bmp",504
load image Dir$+"/Neg_y.bmp",505




`Create Plains
for b = SObj to SObj+5
if object exist(b)=0 then make object plain b,Size#,Size#
if B=SObj then Position object B,0,0,Size#/2
if B=SObj+1 then Position object B,0,0,-1*Size#/2
if B=SObj+2 then Position object B,Size#/2,0,0
if B=SObj+3 then Position object B,-1*Size#/2,0,0
if B=SObj+4 then Position object B,0,Size#/2,0
if B=SObj+5 then Position object B,0,-1*Size#/2,0
`Make plains look less like boxes
texture object b,500+(b-SOBJ) `IF you changed the image numbers earlier, change the 500 to the number of your first image.
`Make plains face the middle
point object b,0,0,0
`Rotate Top and Bottom Plains to specified angle
if b=Sobj+4 then yrotate object b,270
if b=Sobj+5 then yrotate object b,90
`Make Skybox less boxlike
set object ambient b,0
set object texture b,2,0
`Why have the collision on? Turn it off so we don't get any problems. Unless you WANT to be able to bump into the sky
set object collision off b



next b
`set camera to facing pos x
position camera 0, 0, 0, 0
set camera to object orientation 0, 2
`make the cube object, and position it in the center, everything at 0.

`two reference spheres to let you know your moving positioned on the left and right in front of the cube.

`simple object collision done automatically for the 3 objects

`begin with a "do" procedure to start the loop process.
do

`key control using w,a,s,d to make the cube object and the camera follow in the same motion (separated by
`the : symbol) and m,n for turning motions. notemotion will not be detected if the cam and object move
`at the same interval because they are in unison this is also why the two reference spheres were placed)
if inkey$()="z" or inkey$()="Z" then move camera 0, 1.0
if inkey$()="x" or inkey$()="X" then move camera 0, -1.0
if inkey$()="w" or inkey$()="W" then pitch camera up 0, 1.0
if inkey$()="s" or inkey$()="S" then pitch camera up 0, -1.0
if inkey$()="a" or inkey$()="A" then roll camera left 0, 1.0
if inkey$()="d" or inkey$()="D" then roll camera right 0, 1.0
if inkey$()="m" or inkey$()="M" then turn camera right 0, 1.0
if inkey$()="n" or inkey$()="N" then turn camera left 0, 1.0
Print "X Coords> ";Camera Position X()
Print "Y Coords> ";Camera Position Y()
Print "Z Coords> ";Camera Position Z()
Print "X Angle> ";Camera Angle X()
Print "Y Angle> ";Camera Angle Y()
Print "Z Angle> ";Camera Angle Z()

`let it know youve completed commands for this loop.
loop

Believe that we must find a way to bring ethical considerations to bear upon the direction of scientific development.
Sixty Squares
19
Years of Service
User Offline
Joined: 7th Jun 2006
Location: Somewhere in the world
Posted: 15th Jul 2007 14:24 Edited at: 15th Jul 2007 14:26
Hmmm... I've seen this before... Right here actually.

Oh, and when you post code could you put it in small code tags like this:
[ code ]
Code here
[ /code ]

Without the spaces it looks like this:



Glad to see my old code helped someone

Login to post a reply

Server time is: 2025-08-09 01:37:57
Your offset time is: 2025-08-09 01:37:57