Loading a DirectX .X object
by Tim Aidley · in Torque X 2D · 08/31/2008 (9:05 am) · 3 replies
Hi folks, I'm sure I remember reading somewhere in the forum that it was possible to load DirectX .X geometry into your scene. However, I've not had much luck so far in getting it to work.
Looking at the source however it looks as if the ShapeReader class is only for loading DST and DSQ - so would I be right in thinking that I can't read .X files as Shapes?
The other option is to convert the .X files via something like Blender or Milkshape, but so far I've had no luck with them either.
Looking at the source however it looks as if the ShapeReader class is only for loading DST and DSQ - so would I be right in thinking that I can't read .X files as Shapes?
The other option is to convert the .X files via something like Blender or Milkshape, but so far I've had no luck with them either.
#2
Anyway, for anyone else trying to use .X or .FBX files, use the same code as you would for a DTS file, but replace the 'T3DDTSRenderComponent' with 'T3DXNARenderComponent' and the 'ShapeName' with 'Filename'
e.g:
08/31/2008 (11:25 am)
Okay - got it to work now. I ran down a blind alley for a bit because I'd spelled a tag 'FileName' rather than 'Filename'.Anyway, for anyone else trying to use .X or .FBX files, use the same code as you would for a DTS file, but replace the 'T3DDTSRenderComponent' with 'T3DXNARenderComponent' and the 'ShapeName' with 'Filename'
e.g:
<!-- Biplane Object --> <TorqueObject type="GarageGames.Torque.Core.TorqueObject" name="TorqueObject_63220684"> <Components> <T3DSceneComponent type="GarageGames.Torque.T3D.T3DSceneComponent" name=""> <SceneGroup>PlayerObject</SceneGroup> <UseOwnerObjectType>true</UseOwnerObjectType> <Visible>true</Visible> <VisibilityLevel>1</VisibilityLevel> <Position> <X>1023.954</X> <Y>1031.41</Y> <Z>299.33</Z> </Position> <Rotation> <X>0</X> <Y>0</Y> <Z>0</Z> <W>1</W> </Rotation> <Scale> <X>1</X> <Y>1</Y> <Z>1</Z> </Scale> </T3DSceneComponent> <T3DXNARenderComponent type="GarageGames.Torque.T3D.T3DXNARenderComponent" name=""> <Filename>data\Models\biplane\Biplane.xnb</Filename> <SceneGroupName>PlayerObject</SceneGroupName> </T3DXNARenderComponent> </Components> <Pool>false</Pool> <PoolWithComponents>false</PoolWithComponents> <IsTemplate>false</IsTemplate> <IsPersistent>false</IsPersistent> <Notched>false</Notched> </TorqueObject>
#3
09/04/2008 (9:23 am)
In this way you can't use Animation sequences stored in .X files....
Torque Owner Tim Aidley
Okay, so I need to use T3DXNARenderComponent rather than T3DDTSRenderComponent - not quite working yet though - for some reason in the _Load method it's not got the filename of the object for some reason... will continue looking...