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 How to animate character interaction with objects and vehicle(work flow pattern)

Discussion in 'Animation Rigging' started by UDN_e439e96e-49bb-4ebd-a98f-2c9efa572a4f, Oct 25, 2022.

  1. UDN_e439e96e-49bb-4ebd-a98f-2c9efa572a4f

    UDN_e439e96e-49bb-4ebd-a98f-2c9efa572a4f

    Joined:
    Mar 17, 2017
    Posts:
    3
    I havent started it yet but I don't know how to separate the business logic and animation interaction in a way that flows freely.

    example : Character hijacks a car(GTA in 2d)


    Char moves to the car ->char interacts with the car ->hijacks the car-> char moves in a car-> char completes the animation to sit in the car-> Car can now move. (new class movement or separate car driving logic when inside a car)

    what happens if the character get injured between the animation events and the animation is stuck?
     
  2. DanielRiches

    DanielRiches

    Joined:
    Nov 23, 2019
    Posts:
    165

    One method is you can always do an animator check, if your character has a bool getInCar, and thats active so it starts the sequence to get in the car, if the character get's injured and you want it to force it to the injured animation, just check IF character is injured AND the currently playing animation is NOT the injured animation, then disable the getInCar animator bool and activate the injured one, that way it should force it to a new state.

    But the general idea is to check what state your animator is in.