- Home /
Best Practice for animating identical doors?
Hey All,
So here's the situation: I have a 3dsmax model of a building with about 30 identical doors in it, positioned as I need them (it's from a Revit model, for you architects out there). I want to bring it into Unity, then be able to go up to each door and open them individually. I've figured out a few ways to do it, but they're all kind of clunky. Here's what I've tried, what would be better?
Animate and export one door to Unity. Add a trigger (since I want the door opening to be location based), add my script, turn it into a prefab. Copy it 30 times and painstakingly move them into position by hand.
Open file in Max, animate each door individually at intervals. Import to unity, and split the animation into 'OpenDoor01 / CloseDoor01, OpenDoor02 / CloseDoor02...' for every door. Then add triggers to each position, assign a different animation to each, etc. Kinda hard to remember which door number goes with which trigger, though.
Animate one door in 3dsMax, instantiate it to all of the correct positions. Then use 'export selected' to export each into its own fbx and import them all into Unity. Add triggers and scripts.
I like option 1 because having a single prefab definitely makes the most sense, but it's a pain to move everything into position. 2 and 3 are nice because I can do the positioning inside of max, but the work done in Unity is slower and more complex than it needs to be. How do you do things like this? What have you found to work best when working with a repeated element like this?
Answer by Screenhog · Aug 01, 2012 at 07:00 PM
Option 1 is your best bet... and it might not be as painstaking as you initially feared. If you don't know about Surface Snapping and Vertex Snapping, I'd suggest reading this page from the Unity docs: http://docs.unity3d.com/Documentation/Manual/PositioningGameObjects.html
A surprising number of Unity users don't know about this, but it can be a huge timesaver for repositioning GameObjects.
Dang, that is huge! I knew about grid snap, but didn't know about vertex snapping. With this, it's be super easy to get prefabs placed where the existing 'dumb' doors are. Thanks!
Answer by Loius · Aug 01, 2012 at 06:57 PM
You can directly set the values in Unity, too. How is it a pain to move them? Maybe there's an easier way we can point you towards. If you have positions already in Max (relative to the building), for example, you can Use Maths to quickly figure the positions in Unity (again relative to the building).
I'd very highly recommend using prefabs. If you have multiple copies you will hate yourself when you have to make some minor change like opening speed, and you have to locate the thirty copies and change them each individually.
It was going to be a pain to get them exactly where they should be, getting them to match where I currently had 'dumb' doors. With snap as mentioned below, though, it'll be quick and easy!
Thanks for the advice, too. Ja, I really didn't like the idea of not using prefabs, and I'm glad there's a better way to do things than what I'd tried :)
Your answer
Follow this Question
Related Questions
Why does the object alignment only work when the object isn't rotated? 2 Answers
Object position is not as expected in android 0 Answers
Camera rotation around player while following. 6 Answers
Why do my animations keep resetting my prefabs position? 1 Answer
Teleport script, who can help me? 2 Answers