Model Imports Backwards

Hi All,

Not sure where to post this so here goes…

I have a character FBX model with animations. It looks good when I import it however when I use a script to rotate it towards the camera, its back ends walking backwards towards the camera.

MoveToward(Camera.main.transform.position);

//------------------------------------------------------
// Rotate Toward and Move to Target
//------------------------------------------------------
function MoveToward(pos : Vector3) 
{
      var targetRotation = Quaternion.LookRotation(pos - transform.position, Vector3.up);
      targetRotation.x = 0;
      targetRotation.z = 0;
      transform.rotation = Quaternion.Slerp(transform.rotation, targetRotation, .1);
      moveDirection = transform.TransformDirection(0, 0, speed);
      rigidbody.MovePosition(rigidbody.position + moveDirection);
}

I tried making the mesh a child of another object and rotating the transform 180 degress. That works but means I’m adding an extra transformation per instance.

Is this because the model and its animations need to be rotated 180 degrees about the y axis before it is exported? Is there anyway to fix this inside Unity3d? Do I need to rotate the model and animation in an editing package and reexport it?

Thanks.

The Unity docs suggest adding an extra GO to it (yes, meaning another transform). There’s no “rotate on import” that I’m aware of.

What program are you using to model and export?

I bought the models so I don’t know what program was used to actually create them. The came in FBX and max format along with a few other formats I don’t recognize.

OK, so an empty GO at the root to correct the rotation isn’t the worse thing in the world.

I tried that last night and it seems to work. Thanks.

OK, using a parent game object works fine. The model now faces forward.

How do I reference the animation in script now? I tried gameObject.Find(“Model”) but that seems to find the first occurrence in the scene and not necessarily the child of the empty game object I want.

Aha! use transform.Find in the start method…

var anim : Animation = transform.Find("Model").GetComponent(Animation);

Clever.

We are having the exact same issue. We have a model which imports 90degrees off and we’re unable to change the model. We’ve come to the same conclusion that the dummy parent object is the only solution. Ba-humbug!

When you are exporting, try changing the world coordinate system from Z-Up to Y-Up or vice-versa. Some 3D software packages use a different coordinate system than others. You may be exporting to the wrong setup, which will result in models importing at a 90 degree angle.

I wish I were able to experiment with the model program’s export settings, but unfortunately our model guy is MIA. So we’re stuck with what we’ve got.