Search Unity

How to make a T-Rex eat something

Discussion in 'Animation' started by durukanozanalp, May 2, 2019.

  1. durukanozanalp

    durukanozanalp

    Joined:
    Jan 4, 2019
    Posts:
    12
    Hi.

    I am working on a project where the player plays as a t-rex. The t-rex asset has all the animations on itself no problem with that, licenced product. I couldn't figure out how the other object moves with and inside of the mouth.

    Imagine the mouth grabs the object and after couple of chewing it swallows, like in a crocodile documentray. And i am considering to create couple of different objects for this action.
     
  2. PGJ

    PGJ

    Joined:
    Jan 21, 2014
    Posts:
    899
    Place the objects you want to follow the mouth as childs object of the mouth, they should now follow the T-rex.
     
  3. durukanozanalp

    durukanozanalp

    Joined:
    Jan 4, 2019
    Posts:
    12
    And instantiate all the new objects as child, rgiht? Because i want this mini game as an endless runner.
     
  4. PGJ

    PGJ

    Joined:
    Jan 21, 2014
    Posts:
    899
    Yes, anything you want to go into the mouth, should be set as a child.
     
  5. durukanozanalp

    durukanozanalp

    Joined:
    Jan 4, 2019
    Posts:
    12
    Ok. But this time a new question arises which is that i am going to move my t-rex in the endless run, child objects will also move as the t-rex moves. So how can i make the objects move independent till t-rex grabs them?

    Is it possible to set them as child, let's say from being independet to, after OnTriggerEnter for instance?
     
    Last edited: May 4, 2019
  6. durukanozanalp

    durukanozanalp

    Joined:
    Jan 4, 2019
    Posts:
    12
    I might have found a way:
    1- Every instantiated gameObject will have a script which references the t-rex's mouth as parent object.
    2- They will make the mouth as parent after entering the designated collider zone with OnTriggerEnter.
    3- Then they will follow the mouth.