Search Unity

  1. Welcome to the Unity Forums! Please take the time to read our Code of Conduct to familiarize yourself with the forum rules and how to post constructively.
  2. We have updated the language to the Editor Terms based on feedback from our employees and community. Learn more.
    Dismiss Notice
  3. Join us on November 16th, 2023, between 1 pm and 9 pm CET for Ask the Experts Online on Discord and on Unity Discussions.
    Dismiss Notice

Simple Door System?

Discussion in 'Editor & General Support' started by blackdragonstory, Sep 4, 2013.

  1. blackdragonstory

    blackdragonstory

    Joined:
    Nov 21, 2010
    Posts:
    99
    Hi
    I have been trying to do a door system for the model I have.
    The model itself is diveded in 3 parts.left and right side of the door and the thing that acutally holds the doors.
    All the pivots are centered.So the left and right door pivot is right in the middle of the 3rd part but at the center of the door parts other axis.

    So I want to be able to spawn that to any position on the map I have while keeping the door always opening from the right spot.The center of the 3rd part.
    I dont want to use animations cuz I know that animations tend to return to the original position when you play it,so that would work good as I would have this item on different positions.

    I use javascript to code,but since my code didnt work as I wanted it I wont be showing it here.Instead I will show you the animation I ahve in 3ds max.That's pretty much how I want it.

    Also you might wonder why is the door on the ground.Basicly it's not a common door.Basicly when that "door",window opens something would come up from under it and the window would close again.It's still in process of thinking how it should work.

    But just this part would be great if I can make :)

    Animation:
    http://img6.imageshack.us/img6/4554/wxznvgwmfcdqtcmtuajzkz.mp4
     
  2. CrystalSplitter

    CrystalSplitter

    Joined:
    Jun 3, 2010
    Posts:
    25
    Animations don't always have to return to their original position. Simply go into your project panel, find the model, and change the animation wrap mode, to clamp forever.

    If this doesn't work, you can do it in code using
    Code (csharp):
    1. AnimationClip.wrapMode = WrapMode.ClampForever
    .

    By the way, please spend more time making sure you post is readable. I found it very difficult to understand. Luckily, you had a video to explain.

    I hope this helps!
     
  3. blackdragonstory

    blackdragonstory

    Joined:
    Nov 21, 2010
    Posts:
    99
    tnx :)
    Before in the past I had some trouble with animation so I thought it would happen again so I didnt even try it.
    Just tested it.I will definetly use it :D