Game Development Community

Create a T3DXNARenderComponent in code instead of XML

by Trent · in Torque X 3D · 05/19/2009 (4:14 pm) · 2 replies

Ok, so I'm trying to avoid Torque X 3D Builder's flakiness by coding my entire level, but I'm stuck because I'm using .fbx rather than .dts, and it seems that I have no idea how to set the filename property of T3DXNARenderComponent in a way that will cause it to actually load the model. I tried copying the path that Builder generates but I still get file not found.

Here is my current code:

TorqueObject ship = new TorqueObject();
ship.Name = "Ship";
scene = new T3DSceneComponent();
scene.Position = new Vector3(1024, 1124, 300);
ship.Components.AddComponent(scene);
T3DXNARenderComponent render = new T3DXNARenderComponent();
render.Filename = @"data\..\..\..\..\..\Game\Assets\Models\Trent\Exports\terran_bomber_blue.fbx";
ship.Components.AddComponent(render);
TorqueObjectDatabase.Instance.Register(ship);

I get file not found when I register, no matter what path I use. Can someone give me a clue as to what the file path should look like?

#1
05/21/2009 (4:50 am)
Edited my initial message for clarity (I hope).
#2
05/23/2009 (2:33 am)
God that took a long time to work out.

Content is renamed "data", so T3DXNARenderComponent.FileName = "data/data/terran_bomber_blue";

I'm not sure why I have a second data folder.