Importing b3d format

Blitz3D Forums/Blitz3D Beginners Area/Importing b3d format

sec05(Posted 2004) [#1]
Want to ask a question here.

I exported a mesh in 3ds max into a b3d format and I used the loadMesh command to try to import in the b3d file.

The problem is when I run the program, it says "Entity does not exist." Why is that so?


jhocking(Posted 2004) [#2]
code please


Perturbatio(Posted 2004) [#3]
exactly how did you export it to B3D?

Oh yeah and code demonstrating the issue would be useful


sec05(Posted 2004) [#4]
here's the code:

Graphics3D 800, 600
SetBuffer BackBuffer()

Const type_sphere = 1
Const type_cube = 2

camera = CreateCamera()
CameraViewport camera, 0, 0, 800, 600
PositionEntity camera, -50, 50, -100

light = CreateLight()

sphere = LoadMesh("sphere.b3d")
EntityType sphere, type_sphere

cube = LoadMesh("cube.b3d")
EntityType cube, type_cube

Collisions type_sphere, type_cube, 3, 1

While Not KeyHit(1)

; key "w"
If KeyDown(17) Then
MoveEntity sphere, 0, 2, 0
EndIf

; key "s"
If KeyDown(31) Then
MoveEntity sphere, 0, -2, 0
EndIf

; key "a"
If KeyDown(30) Then
MoveEntity sphere, -2, 0, 0
EndIf

; key "d"
If KeyDown(32) Then
MoveEntity sphere, 2, 0, 0
EndIf

UpdateWorld
RenderWorld

Flip

Wend
End

But when I run the program, it says entity does not exists. As for exporting b3d in 3ds max, I keep the default settings.


sec05(Posted 2004) [#5]
By the way, the .bb file is saved under the same folder as the models with the .b3d extension

I have another problem with the coding also. When I tried exporting as .3ds format, it works. The problem is I wanted to test for collision here using the sphere and the cube(like the tutorial) but when I run the program, there is either no collision at all or the collision is very funny.

When there is collision, the sphere stops for no reason at a certain point even though it doesn't touches the cube. But when it touches the cube, it just go through it. Anyone knows why?


WolRon(Posted 2004) [#6]
But when I run the program, it says entity does not exists.
Most likely this is because your LoadMesh() commands failed. Make sure that all of the files are located in the same folder (which you said they were) and make sure they are spelled correctly.

Like I said, the LoadMesh command must be failing although I don't know why. Did you try isolating to see if it's only one of the meshes that don't load or both?


sec05(Posted 2004) [#7]
I tried isolating both of them. Both aren't working.


Perturbatio(Posted 2004) [#8]
does 3DS Max have a B3D exporter?


ashmantle(Posted 2004) [#9]
Please tell us exactly how you exported the B3D file from Max, and we'll probably be able to point out the problem ^^


TomToad(Posted 2004) [#10]
As for your collision problem, check out the EntityBox and EntityRadius commands to change the distance that the collisions are detected.


Hujiklo(Posted 2004) [#11]
Pound to a penny you are setting a parameter for your entity befoe Blitz has loaded it...check the order of your instructions


TomToad(Posted 2004) [#12]
Make sure you're not mispelling the files. Make sure the file really is called "sphere.b3d" and not "shpere.b3d". I just tried your program using my own models called "sphere.b3d" and "cube.b3d" with no problems, so it's not your code.


Hujiklo(Posted 2004) [#13]
Uh - i didn't see your code before...certainly looks like either you're spelling your B3d filename wrong or it quite simply is not in the same directory as your code file...try giving the loadmesh command the full path to you B3d file like "c:\blitz\spampants\sphere.b3d"


Perturbatio(Posted 2004) [#14]
My thought (unless you're using the b3d pipeline or something similar) is that you have simply saved the file with a b3d extension when it is not in the B3D format. I may be completely off the mark with this, but it's my best guess without seeing the model itself.


sec05(Posted 2004) [#15]
I use the b3d pipeline in 3ds max and exported my model using the default setting.

By the way, I use xworld 3d to try out too. I create a cube in xworld 3d, export as b3d file, and when I import the cube into blitz using the loadmesh command, it shows an empty screen only.

I then try to move the cube around (even though there is nothing on the sceen) using the moveentity command. But when I tried that, the "Entity does not exist" pops out again.

Anyone can figure out why?


semar(Posted 2004) [#16]
After the statement:
sphere = LoadMesh("sphere.b3d")
check the value of the variable sphere.

If it is 0 or null, then the .b3d file has not been loaded for some reason. As stated in the above posts, it could be that the exported .b3d file is made in a wrong format, hence it is not properly loaded.

You can try to post a link to the .b3d file you are using, so it can be downloaded; perhaps this help us to find out what's wront with its format.

Sergio.

P.S.
if you use the variable 'sphere' from within a function, you may better declare it as Global in the main section of the code.


sec05(Posted 2004) [#17]
I finally found the problem, haha!

The problem doesn't lies in the code. The b3d file is not wrong either. The problem is that I did not update my version of blitz 3d!

Anyway, thank you so much everyone for helping me!