Search Unity

  1. Megacity Metro Demo now available. Download now.
    Dismiss Notice
  2. Unity support for visionOS is now available. Learn more in our blog post.
    Dismiss Notice

Question Idle animations that are frozen?

Discussion in 'Animation' started by Corva-Nocta, Apr 30, 2023.

  1. Corva-Nocta

    Corva-Nocta

    Joined:
    Feb 7, 2013
    Posts:
    801
    Hi all, trying to figure out how best work this system I'm trying. What I want is for my characters to play an animation, and then freeze in place at the end of the animation. Basically play once, then stop. And I don't mean return to idle, I mean actually freeze all animation. Not sure the best way to do this.

    Should I just go into an animation that has no actual movement? Or should I call an event at the end of the animation that freezes? Or is there another way? I know I don't want to mess with the timescale, since I still want to be able to do other things that will need time (like moving the camera or thr background)

    An example of what I'm looking for: a character is in and idle animation, then draws his sword and points it at another character. At this point all animation stops, but things like camera movement and UI buttons still function like normal. They player then chooses the next move for the character. Which plays the next animation based on the choice.
     
  2. ElXill

    ElXill

    Joined:
    Jun 2, 2017
    Posts:
    43
    Usually when that kind of system is used, while player thinks about a choice, character keeps looping an idle animation for that pose so if you change your mind later it would be better to make it with animation states. But sure you can freeze the character with scripts or events, scale time etc.

    These are pretty subjective but;
    - would use a script if this is an exceptinal case.
    - would use timeScale if everything (enemy, background etc. )needs to stop at that moment. You can use unscaled delta time for stuff that needs to keep functioning/changing according to situation
    - would use states if this mechanic was a main part of the game loop (for me this is easier to organize and more flexible, also still works if you change your mind about freeze to idle animations or something else)
     
  3. Corva-Nocta

    Corva-Nocta

    Joined:
    Feb 7, 2013
    Posts:
    801
    Thanks for the suggestions!

    This will be a core mechanic, so I think I might have to go state driven. Not a problem, I love state machines! Drastically improves how clean code is.

    And it sounds like I might have to go with some form of time scaling, which I haven't ever messed around with. The idea will be to freeze all the characters that I need, but can still do things like camera movement and button presses as normal. I'll look into the time aspect and see what I can come up with.