XNA Creators Club Online
Page 1 of 1 (4 items)
Sort Posts: Previous Next

Glitch with maya model in xna

Last post 04-01-2008 2:05 AM by Jontti. 3 replies.
  • 03-29-2008 5:10 PM

    Glitch with maya model in xna

    hi,

    im having a problem where when i use a model in xna ,made from maya, it doesnt appear in the same place as i placed it while making it (maybe due to the UVs not doing something.... i dunno..)

    any ideas?

  • 03-29-2008 5:57 PM In reply to

    Re: Glitch with maya model in xna

    Hi,

    Maybe I'm not the best person to try to answer (I use Max), but I'm almost certain it has to do with the pivot point of the models. When you export a model (using fbx or x) the model gets centered at the origin regardless of its position in your 3D scene. The only way I know to tell the exporter that a model should have an offset is to move the model pivot point. So if your model is not centered in the origin and you want it to keep its relative position from the origin, just center its pivot point at the origin. Don't know the procedure in Maya, but the concepts are the same.

    Warning: This should be done for models wich position will not change in your XNA scene (i.e. buildings and scene assets and static models) and not for moveable models. Moveable models yould be centered at origin and positioned in the world by code.

    Hope that helps and I'm not completely wrong on this!

  • 04-01-2008 2:05 AM In reply to

    Re: Glitch with maya model in xna

    For the top post...

    Make sure you have unfreezed the object and have the pivot in the center of the object. XNA can't handle local coordinate systems from Maya.

    One way to do it is to center the pivot in the object then move the object to origo and freeze it the move it back to the location you want it... Then best is to have an unfreeze script...

    Here's some MEL for you...

    // --- Copy from here...

    proc moveToOrigoFreezeAndBackAgain () {
    string $selected[] = `ls -sl`;
    string $objekt;
    float $distToOrigoX;
    float $distToOrigoY;
    float $distToOrigoZ;
    for ($objekt in $selected) {
         $distToOrigoX = `getAttr ($objekt+".transMinusRotatePivotX")`;
         $distToOrigoY = `getAttr ($objekt+".transMinusRotatePivotY")`;
         $distToOrigoZ = `getAttr ($objekt+".transMinusRotatePivotZ")`;
         move -r $distToOrigoX $distToOrigoY $distToOrigoZ $objekt;
         makeIdentity -apply true -t true -r true -s true $objekt;
         move -r ($distToOrigoX*-1) ($distToOrigoY*-1) ($distToOrigoZ*-1) $objekt;
         }
    }
    moveToOrigoFreezeAndBackAgain;

    // -- To here and paste into your script editor and mark it all then drag the selection to your shelf

    Yes! Maya PLE can be downloaded for free...
    http://usa.autodesk.com/adsk/servlet/index?siteID=123112&id=7639525

  • 04-04-2008 4:07 AM In reply to

    Re: Glitch with maya model in xna

    This sounds like a freeze transformation problem. It's a common problem since Mya can handle both local coordinate systems and global and in a game you usually use one global coordinate system.

    How to solve this...

    Center the pivot in maya move the object so the pivot is placed in origo and make sure all all translation values are 0.000 (if not then freeze transformations while object is placed in origo), then place the object in it's right possition.

    NOTE! If you move an object within a group node the group gets the translation information and not the object. Then you can simply just unparent the object from the group and exportit and it will automaticly get the right global coordniates.

    Glossary! UVs have nothing to do with the placement of the object as long as you dont have a really spookey UV to Vertex morph-shader. UVs just tells the object how a texture is mapped to the mesh.

     

Page 1 of 1 (4 items) Previous Next
var gDomain='m.webtrends.com'; var gDcsId='dcschd84w10000w4lw9hcqmsz_8n3x'; var gTrackEvents=1; var gFpc='WT_FPC'; /*<\/scr"+"ipt>");} /*]]>*/
DCSIMG