Exporting .X hierarchy to Blitz3D ?

Alan, i use the 5.7a version. In fact, i open the file with 3dc, i export to .x, and just quit.

Could you e-mail me at <!– e –><a href="mailto:hubert.bayre@wanadoo.fr">hubert.bayre@wanadoo.fr</a><!– e –> your corrected model and media ?

Thanks !

Im trying to load a .X hierarchy file into BLITZ 3D. Is this hierarchy set up wright for Two cubes to be children of the parent entity.
(picture below)
If your familler with Blitz,is there something I might be doing wrong in 3DC that could be causing Blitz to not read the children entitys.Countchildren keeps showing only ( 1 ) child?
I can see the cubes I just cant seem to get access to them.All I can do now is get collisions to work on the parent cube only?
Any help would be great. andnbsp;

Alen,
I now got collisions working on the children now( thanks to the help of the Blitz forum).But I still need to find a way to get at each of the children.
What you pointed out about making a child entity a child of another child entity might be the way to go.
Atleast now with collisions working on all children I can now create a sphere and crash it into one of the children entitys then ask blitz to tell me what I hit.Well maby not that easy but you get the idea.
Ill repost my results here somtime this weekend for anybody else that might be interested.
Thanks again Alen.

This is what I think…. <!– s:) –><img src="{SMILIES_PATH}/icon_e_smile.gif" alt=":)" title="Smile" /><!– s:) –>

befor using countchildren() you need to find them…

model= LoadAnimMesh(andquot;bot.xandquot;)
topcube= FindChild(model,andquot;top_cubeandquot;
midcube= FindChild(model,andquot;mid_cubeandquot;)

If you want I have done a small directx demo that I can send you that might help….. ?

+++++++++++++++++++++++++++++++
cannon = LoadAnimMesh(andquot;child.xandquot;)
base = FindChild(cannon,andquot;baseGandquot;)
revolver = FindChild(cannon,andquot;revolverGandquot;)
barrel = FindChild(cannon,andquot;barrelGandquot;)
+++++++++++++++++++++++++++++++

CountChildren(base) returns 2

so maybe you have to have the childen as children of another child rather than directly under andquot;cannonandquot;

Hope this makes sense ?

Now how did that smiley get in there ?
YA…I also relized that in my origanal post I did name the objects frame with the object,I guess with all the messing around I was doing I started losing track of what and how I was doing things.
Any way the Code above works well.
And Alex,your Idea of moving the children will be very helpfull as for that will be my next step as soon as I get this new mesh loading stuff fully incorperated with my Code.

Many thanks for that (,TRUE) I don’t know how I missed it as it is in the help files…

entity – entity handle
collision_type – collision type of entity
recursive (optional) – true to apply collision type to entity’s children

(also to andquot;removeandquot; smilies (if posting code) there is a andquot;tick in the boxandquot; under the message window) <!– s:) –><img src="{SMILIES_PATH}/icon_e_smile.gif" alt=":)" title="Smile" /><!– s:) –>

You said andquot;to find a way to get at each of the childrenandquot; do you mean to move/rotate,etc ?

This is some simple code to do this –

; keys

Const Key_ArrowPad_Up=200
Const Key_ArrowPad_Left=203
Const Key_ArrowPad_Right=205
Const Key_ArrowPad_Down=208
Const Key_W=17

;using window mode
HidePointer
Graphics3D 800,600,0,2
SetBuffer BackBuffer()

; Add Some Light
AmbientLight 255,255,255
light = CreateLight(1)
PositionEntity light,10,10,-20

; create a camera
camera = CreateCamera()

;load directx model and find parts with FINDCHILD — NOTE THIS IS THE GROUP NAMES !!!!!!!
cannon = LoadAnimMesh(andquot;cannon.xandquot;)

base = FindChild(cannon,andquot;baseGandquot;)
revolver = FindChild(cannon,andquot;revolverGandquot;)
barrel = FindChild(cannon,andquot;barrelGandquot;)

; Put The Camera Somewhere And Resize The Model To A Reasonable Size
ScaleEntity cannon,15,15,15
PositionEntity camera,0,0,-80

While Not KeyHit(1)

If KeyDown(key_arrowpad_up) Then TurnEntity barrel,0,0,0.3
andnbsp; If KeyDown(key_arrowpad_down) Then TurnEntity barrel,0,0,-0.3
If KeyDown(key_arrowpad_left) Then TurnEntity revolver,0,0.3,0
If KeyDown(key_arrowpad_right) Then TurnEntity revolver,0,-0.3,0

UpdateWorld
RenderWorld

If KeyHit(Key_W) Then
WireMode = Not WireMode
WireFrame WireMode
End If

Text 0,60,andquot;Simple Direct X Demo – by Alanandquot;
Text 0,80,andquot;Use The Arrow Keys To Move The barrel / base (revolver) andquot;
Text 0,100,andquot;’W’ to toggle wireframe modeandquot;

Flip

Wend

Might help ?

and the model

Alen,
Thanks alot for your help.I have managed to get it all to gether now.
My trouble with finding Children was I was naming my children using the objects box ( Brown Cube ) Not the Objects Frame ( yellow cube )from with_in the hierarchy panel.
Here’s a simple code example.
The .X file from 3DC can be loaded using, File/Export/DirectX(.X)The mesh dose not need to be saved as a hierarchy .X file.

Graphics3D 800,600
SetBuffer BackBuffer()
cam=CreateCamera()
PositionEntity cam,0,7,-10
light=CreateLight()

Const type_Ball=1
Const type_Obj=2
Global andnbsp;Collision_Mode

ball=CreateCube()
EntityColor ball,150,0,0
ScaleEntity ball,.5,.5,.5
PositionEntity ball,-3,0,0
EntityRadius ball,.5
EntityType ball,type_Ball

Obj=LoadAnimMesh(andquot;objectstest22.xandquot;)
PositionEntity Obj,0,0,0
EntityType Obj,type_Obj,TRUE
andnbsp;
{{{{{ ADDING (TRUE) TO THE ENTITYTYPE STATEMENT ABOVE WILL ADD COLLISIONS TO ALL CHILDREN OF THE LOADED ANIM MESH }}}}}}}}

Collisions type_ball,type_Obj,2,2

While Not KeyHit(1) andnbsp;;]WHILE LOOP[;

; Use { COLLISION_WITH $ } To call up the entity the ball has collided with.

collision_mode=0
collision_with$=andquot;andquot;

If CountCollisions(ball)
Name#=EntityCollided(ball,type_obj)
Collision_with$=EntityName(Name#)
End If

If collision_with=andquot;groundandquot;
andnbsp; Collision_mode=1
End If
If collision_with=andquot;stepsandquot;
andnbsp; Collision_mode=2
End If
If collision_with=andquot;climbandquot;
andnbsp; Collision_mode=3
End If andnbsp;

If KeyDown(200)
MoveEntity ball,0,0,+.2
andnbsp;End If
andnbsp;
If KeyDown(208)
MoveEntity ball,0,0,-.2
andnbsp;End If andnbsp;

If KeyDown(203)
TurnEntity ball,0,+3,0
andnbsp;End If

If KeyDown(205)
TurnEntity ball,0,-3,0
andnbsp;End If

If KeyDown(30)
MoveEntity ball,0,+.15,0
andnbsp;End If
andnbsp;
If KeyDown(44)
MoveEntity ball,0,-.15,0
andnbsp;End If

;;;;;;;;;;;;;;;UPDATE-WORLD_STUFF;;;;;;;;;;;;

UpdateWorld andnbsp; andnbsp; andnbsp; andnbsp; andnbsp;
RenderWorld

Text 0,20, andquot;Mode….andquot;+Collision_mode andnbsp; andnbsp; andnbsp; andnbsp; andnbsp; andnbsp; andnbsp; andnbsp; andnbsp; andnbsp; andnbsp; andnbsp; andnbsp; andnbsp; andnbsp;
Text 0,35, andquot;Child…..andquot;+Collision_with

Flip
PointEntity cam,ball
Wend
End

;End Of Code,,,,,,,

Quote:
Alen,
I now got collisions working on the children now( thanks to the help of the Blitz forum).

Could you post this info please ? (or point me at it ?)

Many thanks

Alan

I have taken your 3dc file and resaved it to *.x (hierarchy) and it ran as expected (textured) in blitz3d….(i did rename the groups to their own names and I also used one of my own textures)

What version of 3dc are you running ? if not the latest then an upgrade might sort this (when I loaded your file the message about converting it to v 5.71 came up so maybe all you need is v5.71 ? There was an andquot;Improved DirectX Exportandquot; in v 5.6.)

here the 3dc file : [img:1di4ixdi]http&#58;//www&#46;bayre&#46;com/worklog/upload/player_upjump&#46;zip[/img:1di4ixdi]
<!– m –><a class="postlink" href="http://www.bayre.com/worklog/upload/player_upjump.zip">http://www.bayre.com/worklog/upload/player_upjump.zip</a>&lt;!– m –>

Hi !

a few day ago i’ve posted this thread into the blitz3d forum. I wanted apply the same texture into an .x animated mesh without know its hierarchy. Today, i’ve not yet a solution to my problem… See the thread for more informations… Perhaps someone here have a idea.
Is there a bug into the .x 3DC exportation ? (it works with another animated .x file not produced with 3dc !)

[img:2xtd2k4u]http&#58;//www&#46;blitzbasic&#46;com/bbs/posts&#46;php?topic=12269[/img:2xtd2k4u]
<!– m –><a class="postlink" href="http://www.blitzbasic.com/bbs/posts.php?topic=12269">http://www.blitzbasic.com/bbs/posts.php?topic=12269</a>&lt;!– m –>

Graphics3D 800,600,32,2

AmbientLight 100,100,100

Function texture(entity, CodeType)

EntityTexture entity, CodeType

For a=1 To CountChildren(entity)

Child=GetChild(entity,a)
DebugLog andquot;Child=andquot; + Child

texture(Child, CodeType)

Next

End Function

MyMesh = LoadAnimMesh(andquot;player_upjump.xandquot;)

camera = CreateCamera()
PositionEntity camera, 0,2,-5

tex = LoadTexture (andquot;classiqu.bmpandquot;)
texture (mymesh, tex)

Animate Mymesh

While Not KeyDown(1)

UpdateWorld
RenderWorld
Flip

Wend

media here : [img:2xtd2k4u]http&#58;//www&#46;bayre&#46;com/worklog/upload/anim_020902&#46;zip[/img:2xtd2k4u]
<!– m –><a class="postlink" href="http://www.bayre.com/worklog/upload/anim_020902.zip">http://www.bayre.com/worklog/upload/anim_020902.zip</a>&lt;!– m –>

THANKS !

can you put up a zip with the 3dc model ? I will have a play and see if I can see anything……

Thank you Alan, I now understood where was my error. andnbsp;

After having finished the modelisation with 3dc, i have paint some faces of my model of various colors (tool andnbsp;face ‘paint’). andnbsp;But andnbsp;I did not really apply a texture (external file) to these faces ! andnbsp;It is only one uniform color which is certainly recognized by the directx format… a single rgb value !

Applying really a texture (from an external file, but always by using the tool ‘paint’) have to create additional information in the x. file.

After having applied a texture with 3dc to each part of the model you can after change dynamically the texture of this model in blitz3d. andnbsp;

To summarize, it missed uv/texture information in the fichier.x since I did not have really to texture my model a first time.

Thank you Alan, without your assistance I would never have understood that! andnbsp;

Hope this post also help the others 3dc users with their game !

You must be logged in to reply in this thread.

22 posts