loading meshes
Blitz3D Forums/Blitz3D Beginners Area/loading meshes
| ||
hi all, i have made some models in blitz3d and would like to incorporate them to a game i am working on. The question is...do i have to copy and paste all the code where all the other stuff is or can i simply save the model i made(.bb) and then load it into the game using model=LoadMesh("model.bb") please tell me if i can do this, i have tried but the model didnt show. Does anyone know what i am doing wrong? thanks |
| ||
I do not believe that it is possible to load a .BB file using the LoadMesh() command. You may want to try using the Include command, instead. For example: Include "model.bb" |
| ||
Models often do not show in Blitz3D. Quite often it is due to scaling - ie the model is too big or too small and it needs to be scaled, which Blitz3D can do. When loading a model into B3D, it's always handy to use PointEntity camera,entity - at least then you have an idea of where your model is. Try moving the camera on the Z plane - PositionEntity camera blah, blah, Z - to move the camera in and out of the scene - if the model is too big, you need to move the camera out of the scene. If this doesn't work then you will need to mess around with ScaleEntity. |
| ||
this is what i have:Graphics3D 1280,800 SetBuffer BackBuffer() light=CreateLight() cam=CreateCamera() model=LoadMesh("model.bb") PositionEntity model, 0,0,6 ScaleEntity model, 0.3,0.3,0.3 While Not KeyDown(1) RenderWorld Flip Wend End When i try this, an error pops up saying 'Entity does not exist'. Oh and, i am not familiar with the 'Include' command. Can someone please tell me what i put after i wrote Include "model.bb"as i dont know. thanks anyway |
| ||
your command for loading model should be MODEL=LoadMesh("Model.b3d") or MODEL=LoadMesh("Model.3ds") or MODEL=LoadMesh("Model.x") |
| ||
If you are creating a blitz model, inside blitz, you only need to include the .bb file that creates. i have made some models in blitz3d How have you made models in blitz3d? Out of primatives shapes? By manually coding vertex positions and creating triangle? Or, do you mean you have made a model FOR blitz in a modelling package? If you could answer that, we can help you better. |
| ||
i have made models using spheres and cubes. Then just positioned them to make a model |
| ||
put the code for making a model in a function, then include the .bb file. Use the function for the model in the new program, then it will work. example: include "model.bb" DrawModel() ;user made function to draw the model from the include waitkey() and this is kind of what model.bb should look like Function DrawModel() ; you have to put the code in a function to use it sphere = createsphere() posionentity sphere 0,0,0 End Function |
| ||
i dont know why, but it still doesnt work :( i did what you said, Cp, but when i try to run the program, it says 'unable to open include file' does anyone know why this is not working? |
| ||
Step by step: 1. Write code for positioning/creating your model. 2. Save it as model.bb. Make sure it's saving in the same folder as the code that is including it. 3. Include the file into your main code. OR 1. Write code for positioning/creating your model. 2. Put this code in a function. 3. Simply copy the function to your main code. 4. call the function to create your model. Both steps will work fine. |
| ||
Yess, it works now, thanks so much Ross! |
| ||
Good stuff! |