0
\$\begingroup\$

I am building a sims-like game where there are a lot of objects for my autonomous characters to interact with.

Because of this, as much of the unique interaction code as possible is controlled by the objects, rather than the characters. This prevents unnecessary script bloat.

However, many of these objects also have unique animations used to interact with them. Like the actual behaviour, I'd prefer to store these animations on the object rather than the characters.

Though all my characters possess an Animator, I see no way to trigger animations that aren't on the associated Animation Controller.

What options does this leave me with? Can I somehow drastically alter the controller at runtime? Is that the smart approach?

\$\endgroup\$
6
  • \$\begingroup\$ It sounds like the Animation Override Controller might be useful for this. The docs show an example of using it to swap out a shooting animation each time the weapon is changed, so similarly your object could swap out the "interaction" animation for the clip that interacts with this object. \$\endgroup\$
    – DMGregory
    Mar 25 '21 at 12:04
  • \$\begingroup\$ Possibly. I'd have to find a way to at least unify the animation structure then... \$\endgroup\$
    – Weckar E.
    Mar 25 '21 at 15:17
  • \$\begingroup\$ Or at least categorize them into distinct "slots", like a "door interaction slot" versus an "interact with item on ground" slot versus a "wield tool/weapon" slot... \$\endgroup\$
    – DMGregory
    Mar 25 '21 at 15:19
  • \$\begingroup\$ Restricts things a bit, as my objects vary from chairs to baseball bats to arcade cabinets... but I'll make it work. \$\endgroup\$
    – Weckar E.
    Mar 25 '21 at 16:26
  • \$\begingroup\$ @DMGregory I really wish you would post more answers rather than comments. You deserve credit for providing even partial solutions. \$\endgroup\$
    – Weckar E.
    Mar 25 '21 at 23:27

You must log in to answer this question.

Browse other questions tagged .