Search Unity

Question Having an "Animation within an Animation" (Person in Car)

Discussion in 'Timeline' started by RevolutionEve, Jan 15, 2021.

  1. RevolutionEve

    RevolutionEve

    Joined:
    Jul 26, 2020
    Posts:
    7
    Hello,
    I have a 3D Scene, with a 3d Prefab Caracter (Humanoid) and a Car.

    What I want to do: Put an "driving" Animation to the Character (loop) and move the car with the character inside alot the screen.

    I am always having Problems with the Charater beeing on totally off positions outside the car when i start moving the Timeline.

    What is the best way to do it?

    - Should the Character be a "Child" to the Car?
    - What Animation Tracks and so on should i put on timeline?

    I tried different variations but somehow always ended up with the character beeing in the wrong spot.

    Sorry, i am very new to this :-(

    WIshes,
    Maria
     
  2. tree_arb

    tree_arb

    Joined:
    Dec 30, 2019
    Posts:
    323
    I don't know much about timeline and animation tracks. Hopefully someone else chimes in on that.

    However most scenarios i would likely put the character as a child of the car either by dragging it in the hierarchy, or by script. Most cases parent and un-parent it to the car as it gets in and or out of the vehicle.

    If the car is complex you might need to experiment w placement. Example: parented to the wheel, the character might rotate wrong or something.

    In a normal game situation. If you parent the character to the car, you can move the car and the character stays inside. Any other option would have to be to update the characters transform every frame by script.
     
  3. RevolutionEve

    RevolutionEve

    Joined:
    Jul 26, 2020
    Posts:
    7
    Thanks for your answer. Thats what I tried. I tried to child it to the car. I created also an empty and put the car and the character below the Empty and tried to move the empty.....never were able to get it to work :-(
     
  4. DavidGeoffroy

    DavidGeoffroy

    Unity Technologies

    Joined:
    Sep 9, 2014
    Posts:
    542
    There are a few solutions:

    • You can animate the driver as part of the car (and disable the drivers animator when driving). This requires parenting the driver to the car and authoring the animation clip there, all in a single track
    • Your can have separate tracks, and parent the driver to the car seat, or some other mostly fixed point in the car. Again, you animation for the driver should be authored with the driver parented to the car, so you can verify that it's correct when played that way.
     
  5. RevolutionEve

    RevolutionEve

    Joined:
    Jul 26, 2020
    Posts:
    7

    i just don´t get it to work.....getting cray :-(

    I uploaded a video for you to see....



    There is a humanoid character called "Yasmin", with an Animation Track (a looping driving animation) and an overide Track in the Timeline.
    There is a car called "Delorian" with an Animation Track in the Timeline

    Then, as you can see in the video, I parent "Yasmin" to the "Delorian" and Press play.

    And BOOM...everything f**s up. It puts "Yasmin" somewhere in the scene an also messes up the Animation and the proportions of the Character.....

    ANY help really appriciated...:-(
     
  6. RevolutionEve

    RevolutionEve

    Joined:
    Jul 26, 2020
    Posts:
    7
    Update: I did a test:

    - I used a simple 3d Cube as "Car" and did the same as above...and it WORKS!

    What does this mean? How can the Car be the Problem? Can i have done something wrong with the Car Model, so that it F***s up the childs animation?
     
  7. tree_arb

    tree_arb

    Joined:
    Dec 30, 2019
    Posts:
    323
    The car must have a script or component on it that's doing something. I was actually going to suggest the reverse, that the character had a script repositioning or scaling itself.

    Take a look at the car prefab and which components are on it. You can uncheck them in the inspector one by one and hit play to determine which one the issue is in.
     
  8. DavidGeoffroy

    DavidGeoffroy

    Unity Technologies

    Joined:
    Sep 9, 2014
    Posts:
    542
    There's a few things here:

    1. Your car probably has a non-uniform scale somewhere, which is why your character is flat.
    2. This pose you are seeing is the "relaxed" pose for the Humanoid. This is essentially the middle position on all the muscles. I means your character is not getting animated.
    3. As for the offset, it's hard to tell