Change rotation axis when importing from Maya

I’m having a problem where, when I import a model from Unity, it appears to transform along the wrong axis. When I opened the mesh in Maya again, i realised it was facing the wrong way, as in the ‘front’ side was actually the right side of the model. However, even after I group and rotate it, it still faces the wrong way. This is the code I’m using to animate the model:

void Update () {
	
		if (Vector3.Distance(transform.position,target.transform.position) < 10) {
			animation.Play("ToySoldierWalk");
			leftArm.animation.Play("ToySoldierArmLSwing");
			rightArm.animation.Play("ToySoldierArmRSwing");
			key.animation.Play("ToySoldierKeyTurn");
			
			transform.LookAt(target);
			transform.Translate(Vector3.forward * walkSpeed * Time.deltaTime);
}

The model moves towards the target facing the wrong direction, right side first. I was wondering if there was a way to change the rotation axis or the direction it moves in by the script? I have some experience with Unity but am more used to coding in JavaScript, however I would prefer to do the scripting for this project in C#.

Thanks for any help!

2 Answers

2

Remember, forward is Z axis in Unity. Just make sure you have it set up that way in Maya, and check your export options.

Thank you for answering, I've tried rotating the model in Maya though, facing forwards the correct way on the Z axis but when I import it to Unity it still does the same thing, so I was wondering if I could change it through coding in Unity instead.

–

Did you get this worked out? I am trying to figure out the same thing, exporting rotations from unity to read into maya, but can’t figure out how I am supposed to deal with left handed vs right handed z-axis and rotation order