1
\$\begingroup\$

I am new at XNA, i have started it about a week earlier but i have 3d experience in WPF.

Scenario: I have a room in which i have a object(for now it is a cube). The objects are generated in Max 2011 in the designers computer which i import into mine using fbx importer.

Problem: 1. The model are not positioned as per the max files, and also there are losses in the models.

In Max: http://i.imgur.com/iNJGTh.png
In XNA: http://i.imgur.com/ZXoU8.png

Could anyone suggest me how to resolve this problem?

  1. Is there a dynamic way to get the camera position information from the "FBX" file that i exported from 3Ds Max?
\$\endgroup\$
1
\$\begingroup\$

The model is imported with the proper transforms to set it up the way it is in max. You must account for those transforms in your c# code like this:

//in the fields declaration 
Matrix[] modelTransforms;

//in the loadContent method after loading the model
modelTransforms = new Matrix[model.Bones.Count];
model.CopyAbsoluteTransformsTo(modelTransforms);

//in your draw method
effect.World = modelTransforms[mesh.ParentBone.Index];//where 'mesh' iterates through all objects in the model.

The camera position is not imported with the fbx. Your best shot there is to right click the 'Move Gizmo' in max and record the position of it (remember to set Z = -Y & Y = Z due to the zup/yup swap) then in c# camera setup:

Matrix view = Matrix.CreateLookAt(recordedPosition, Vector3.Zero, Vector3.Up);

now the camera is set the same as max.

| improve this answer | |
\$\endgroup\$
  • \$\begingroup\$ here is a code sample showing this answer:pastebin.com/rrbUyTzB \$\endgroup\$ – Steve H Mar 1 '12 at 15:50
  • \$\begingroup\$ thanx that did it. \$\endgroup\$ – sanddy Mar 5 '12 at 4:40
1
\$\begingroup\$

I don't believe there is a built in way to get the camera position from an embedded camera in an FBX file imported to the Model class. You would probably need to write your own content importer that imports the FBX file to a class of your own (you can probably reuse a lot of the FBX importer so it shouldn't be too much work).

As for the position, XNA is right handed so make sure you export using a right handed coordinate system.

| improve this answer | |
\$\endgroup\$
  • \$\begingroup\$ thankyou for the information, could you redirect me to some urls which could get me started on writing a class for fbx imported datas...i would much appreciated that... \$\endgroup\$ – sanddy Mar 1 '12 at 9:56
  • \$\begingroup\$ Well this would be the general starting point: msdn.microsoft.com/en-us/library/bb447754.aspx \$\endgroup\$ – Roy T. Mar 1 '12 at 14:08
  • \$\begingroup\$ thanx Roy.It seems to be a promising page. \$\endgroup\$ – sanddy Mar 5 '12 at 4:41
0
\$\begingroup\$

It's possible, your model is exported with some transformation. I don't use Max, but you should try to find something like Freeze transformation (so your Rotation, Transformation and Scale are all default).

| improve this answer | |
\$\endgroup\$

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service, privacy policy and cookie policy

Not the answer you're looking for? Browse other questions tagged or ask your own question.