Several models in a B3D file ...

Blitz3D Forums/Blitz3D Beginners Area/Several models in a B3D file ...

ghost(Posted 2005) [#1]
Hi,
I've several different models built in a B3D file ... Can I have access to one or another separately when programming in BB ??
That would be cool :)


Dreamora(Posted 2005) [#2]
You can access them seperately but not position them seperately. For that you need to put them in different files.


Ross C(Posted 2005) [#3]
You could try and use the find child command on them. You sohuld be able to position them that way :o)


Beaker(Posted 2005) [#4]
You will be able to position/scale/rotate them all seperately (use LoadAnimMesh() and FindChild()).


ghost(Posted 2005) [#5]
Thanks all.
I will try that this evening.
But speaking of the LoadAnimMesh command, the help file says that it only works with 3ds or x files.
Is that correct ?


Beaker(Posted 2005) [#6]
No. It works with B3Ds as well.


ghost(Posted 2005) [#7]
It works !
Great great great :)

I've just tried to put an object in another position when collision occurs with it and all is ok.
Not tried to rotate or scale it but I suppose it's ok too.

FYI, my map is a DeleD level that contains a main level and several things like doors ...
So I can built and put my doors in DeleD and then I can open or close them in BB with the "child" method.

Nice !

Thanks.


ghost(Posted 2005) [#8]
Mmmmm little problem here now ...

I have several torchs in my level.
And I want to put a little bit of fire on top of them (of course :o)).
I use the GetChild command to create all the torchs entities from my b3d file. All is ok.

But I need to know the x,y,z coords of each torch entity and they all seem to be the same as the parent entity ...

I've tried both EntityX/Y/Z(torch) and EntityX/Y/Z(torch,true) with no luck.

Is it possible to get the exact coords of a child entity just after a LoadAnimMesh command ??

OL.


Gabriel(Posted 2005) [#9]
Yes, it is, and you're already doing the right thing. EntityX(Torch,True) should return the correct position. Since it isn't, the problem is your mesh, not your code. Evidently, you've exported your objects all based around a single pivot. You're going to have to go back into your modeller and see what you can adjust to give the objects a local pivot point. If you're not sure how to do that, tell us what modeller you're using and I'm sure someone else using the same modeller will know how.


ghost(Posted 2005) [#10]
Maybe using TFormedX/Y/Z could help me ??


Gabriel(Posted 2005) [#11]
I don't see how. If the objects had separate pivots, EntityX(Torch,True) would work. If they don't, the information just plain isn't there. If the information isn't there, there's nothing you can do in code to magically recreate it. If it's a simple object like a cube, you could parse the vertex data and calculate the geometric center, but that will only work for simple objects.


ghost(Posted 2005) [#12]
Hi Sybixsus,
my level is built with DeleD 1.32 PRO and I use its B3D exporter plugin.
As far as I know, there's nothing about pivot points in DeleD ... but I'm going to ask for help on the DeleD forum.
For now I have to manually put each flame (particles emitter) on top of each torch, not really what I was expecting to do at first :o)


jfk EO-11110(Posted 2005) [#13]
you could also check the position of the first vertex of each torch entity, then use TFormPOint to get its absolute world position.


Ross C(Posted 2005) [#14]
Perhaps this code could help you:

http://www.blitzbasic.com/codearcs/codearcs.php?code=732