Take the 2-minute tour ×
Game Development Stack Exchange is a question and answer site for professional and independent game developers. It's 100% free, no registration required.

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?
share|improve this question
add comment

3 Answers

up vote 1 down vote accepted

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.

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

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.

share|improve this answer
    
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... –  sanddy Mar 1 '12 at 9:56
    
Well this would be the general starting point: msdn.microsoft.com/en-us/library/bb447754.aspx –  Roy T. Mar 1 '12 at 14:08
    
thanx Roy.It seems to be a promising page. –  sanddy Mar 5 '12 at 4:41
add comment

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).

share|improve this answer
add comment

Your Answer

 
discard

By posting your answer, you agree to the privacy policy and terms of service.

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