Loading a b3d object

Blitz3D Forums/Blitz3D Beginners Area/Loading a b3d object

LuckyPhil(Posted 2003) [#1]
Hi there,

I'm new to B3D so please bear with me. :)

I created a b3d file using Quill3D but I can't seem to load it in my Blitz3d program.

Here is a snippet of my code:

	b1 = LoadMesh("media\buildling1.b3d")
	;b1 = CreateCube()
	b1_tex = LoadTexture("media\building1.jpg");
	EntityTexture b1, b1_tex
	PositionEntity b1,5,1,5


The error I get is "Entity does not exist" on the 'entitytexture' line. when I try and access b1. If I rem out the LoadMesh line, and use the CreateCube line, everything works great!

I also have rem'd out the entity texture line and it crashes on the positionentity line. The debug value of b1 is 0. If I use the createcube then the value of b1 is a large value.

I have the b3d file, as well as the texture in the same media directory, but I just can't get it to work.

I also find it strange that none of the sample programs included in Blitz3D use any b3d files. They all use X and 3DS files. I would have thought that there should be at least 1 example that used the B3D file format!

There must be something I am missing. Need help!

Cheers,
Lucky Phil.


Rob Farley(Posted 2003) [#2]
You've mis-spelt building1 "build*L*ing1".

The reason why there are no B3D files in the examples is because the examples were written before the B3D format existed.


LuckyPhil(Posted 2003) [#3]
Do I feel silly now! :)


semar(Posted 2003) [#4]
@LuckyPhil,
first of all, welcome to Blitz3D !

Just a note.

If you want to verify that your media has been correctly loaded, just check the returned handler; if it is null, then the media is not loaded. The same behavior applies to sounds, bitmap, and the like.

So, for example:
b1 = LoadMesh("media\building1.b3d")

if b1 = 0 then
;something is wrong !
print "b1 not loaded !"
endif


You can also make your own loadmesh function:

b1 = load_mesh("media\building1.b3d")

.
.

function load_mesh(the_file)

temp = loadmesh(the_file)
if temp > 0 then
return temp
else
print "ERROR ! File " + the_file + " Not Found !"
waitkey
endif
end function


Hope this has sense for you,
Sergio.


LuckyPhil(Posted 2003) [#5]
Hi Sergio,

Glad to be part of the community. I've been a lurker for the past month, and only recently bought B3D and Quill3D to get stuck into that "game that I always wanted to code, but never had the tools".

That function is a great idea.

Thanks for your help. Really appreciated.

Cheers,
LuckyPhil.


Ross C(Posted 2003) [#6]
Yeah, good luck with your project and welcome :)