playMaker

Author Topic: Animal AI tracking body part to target?  (Read 1744 times)

daniellogin

  • Full Member
  • ***
  • Posts: 215
Animal AI tracking body part to target?
« on: June 07, 2018, 09:32:25 AM »
I'm looking for a link to a resource or maybe a helpful description here about how to set up animation/movement of a character's specific body part targeting another object.

So for example a dog that tracks towards a ball (running or walking), then when close enough, it animates leaning down to pick the ball up with it's mouth. I could do a simple animation, but what if the ball is sitting up on a chair? The dog would put it's mouth to the floor (under the ball) and it would look weird that it grabs it. Similarly, it would be wonky if the dog is supposed to take a treat from my hand but doesn't take into account how high I'm holding it (so just bites air above or below the object).

So back to question: Where do I start to understand how a character can have it's body part track somewhat accurately?

All I know is that the model would be rigged with a skeleton. I know enough to start a regular baked animation, but I have no idea about how kinematics works (or what exactly that is) and how to have animations/motions for separate body parts that are independent from each other.

Athin

  • Full Member
  • ***
  • Posts: 163
Re: Animal AI tracking body part to target?
« Reply #1 on: June 07, 2018, 10:53:47 PM »
I'm not really an animator myself but what I've seen is usually models broken down into parts (Ex head, foot, jaw, tail) and all parented to a game object to hold them all. That lets you animate separate parts independently and move the parent object to move all the parts together.  Doing this you can add an FSM to the head and have a smooth look action to the object its chasing.  Can also use the Get distance between the two to trigger the biting animation.

Like I said I'm not really familiar with animations but maybe that can give you an idea to start with?

daniellogin

  • Full Member
  • ***
  • Posts: 215
Re: Animal AI tracking body part to target?
« Reply #2 on: June 08, 2018, 04:39:43 AM »
Quote
usually models broken down into parts (Ex head, foot, jaw, tail) and all parented to a game object to hold them all. That lets you animate separate parts independently and move the parent object to move all the parts together.
I roughly know about this. It's what I figured but the next part is my question:
Quote
Doing this you can add an FSM to the head and have a smooth look action to the object its chasing.  Can also use the Get distance between the two to trigger the biting animation.
This what I need a guide for. How do you get the head to track to something... but not just float off away from the body chasing the target? It needs to be tethered on one end (neck to body) but tracking on the other (face direction, height, etc).

Athin

  • Full Member
  • ***
  • Posts: 163
Re: Animal AI tracking body part to target?
« Reply #3 on: June 08, 2018, 06:52:42 AM »
Have the Parent object that controls all the parts control the actual moving position.  Then have the head part control the rotation. Using a Smooth Look At direction for the head will just rotate the head towards whatever you point it at and the Parent Object will then move all the parts towards it.

If you play around with those actions you can probably achieve what you're looking for.