3D Solar System
Blitz3D Forums/Blitz3D Programming/3D Solar System
| ||
I'm making a solar system and for some reson it won't work. (Get the textures from 3dcafe.com)AppTitle "Solar System Sim" Graphics3D 1280,1024,32,0 SetBuffer BackBuffer() camera = CreateCamera() light = CreateLight() Sun = CreateSphere() Mercury = CreateSphere(10,Sun) Yellow = CreateBrush(255,255,0) tex = LoadTexture("Mercury.bmp") brush = CreateBrush() BrushTexture brush,tex PaintMesh Mercury,brush FreeTexture tex FreeBrush brush PositionEntity Sun,0,0,0 PaintMesh Sun,Yellow FreeBrush Yellow While Not KeyHit(1) RotateMesh Sun,0,5,0 RenderWorld Flip Wend End |
| ||
The camera is not positioned, so it starts at 0,0,0 - effectively inside the sun. When you run your code all you can see is a black screen. Try putting "PositionEntity camera,0,0,-10" below the CreateCamera line, so you can at least see something happening. |
| ||
It says "Could not load: Mercury.bmp" Here is the new version:AppTitle "Solar System Sim" Graphics3D 1280,1024,32,0 SetBuffer BackBuffer() Global camera = CreateCamera() PositionEntity camera,0,0,-10 Global light = CreateLight() Global Sun = CreateSphere() Global Mercury = CreateSphere(10,Sun) Global Yellow = CreateBrush(255,255,0) DoLoadBrush(Mercury,"Mercury.bmp") PositionEntity Sun,0,0,0 PaintMesh Sun,Yellow FreeBrush Yellow While Not KeyHit(1) RotateMesh Sun,0,5,0 UpdateWorld RenderWorld Flip Wend End Function DoLoadBrush(mesh,what$) If FileType(what$) = 0 Then brush = LoadBrush(what$) If brush = 0 Then RuntimeError "Could not load: " + what$ EndIf Else RuntimeError what$ + " does not exist" EndIf PaintMesh mesh,brush FreeBrush brush End Function |