Heya!

I am trying to import a model I made in Maya into Unity with the animations I have created. I have made a simple house proxy object and animated doors to open. I want to be able to control these door animations separately however so as 1 may be open whilst another is shut. When I import the model as a whole (House Mesh and doors), I am only able to animate the whole thing at once. All the doors will open, or all the doors will close.

If I import the doors separate to the house mesh, I get what I want but the doors are not aligned in the correct place. I am not a fan of manually trying to place things accurately and know there must be a better way for what I’m trying to do.

The better way is to not use animation at all- if you script the doors manually, you get individual control, and you don’t need to place everything yourself. A simple script with something like this on it would do the trick-

public float maxOpening = 120;
public bool opening = false;
float currentOpen = 0;

void Update()
{
    if(opening)
    {
        currentOpen = Mathf.Clamp01(currentOpen + Time.deltaTime);
    } else {
        currentOpen = Mathf.Clamp01(currentOpen - Time.deltaTime);
    }
    float currentAngle = Mathf.Lerp(0, maxOpening, currentOpen);
    transform.localRotation = Quaternion.AngleAxis(currentAngle, Vector3.up);
}

Then, to control that, just set ‘opening’ to either true or false to open the door or close it.

Hey syclamoth! Thanks a lot for the reply. However I chose to stick with animation because I want the doors to do more than just open and close (Sorry I forgot to mention that!).

I found a solution to my problem however, and I’ll share it in case anyone else is having problems. What I did was:

  1. Parent the doors to the house mesh.
  2. Selected the door mesh by itself
  3. Exported to Unity
  4. Selected the house mesh by itself
  5. Exported that to Unity also
  6. Put the objects into my Unity scene, set their transform values to 0,0,0, and their scale values to 1,1,1
  7. I know have a door with an animation component separate to the house but in the right position

Thanks!