Dragons and Nuns

Read Time:2 Minute, 45 Second

So I said to my kid, I bet I can put a Dragon into the game…

Thar be dragons!

So how do we do this thing?

First, we need a Controller for the Dragon and we need to get the Dragon’s Avatar. In this case, the guys and gals at Infinity PBR provided a controller hooked up on the model, so I just stole the Avatar off of that one. The Controller is duplicated from the Zombie Controller.

In the graphic below you can see the various animations from the Dragon PBR character. All you need to do (AFTER duplicating the Zombie Animator Controller) is replace each of the animations with the corresponding animation from the Dragon.


Bug in the Dragon Attack

So the next step is to get that Dragon to attack. I’ve got it working… sort of. She doesn’t seem to want to stop on a dime and she attacks longer than she should.

What troubles you my sweet?

Prefab Variants

Well, before we get too far into it, here’s a video about creating a new base prefab for my Enemy Game Object and then deriving Variants from it:

I love Prefab Variants. I think… I’m still too new at this. They may just be shiny.

Code Review

Time for an Architecture Review on the Attack AI. Let’s see what’s in there that might need fixing.

This code is broken. We should fix it.

To-Do List:

  1. Change the Attack Trigger to a boolean flag.
  2. Figure out why the Dragon has a couple of extra running cycles with no actual movement.

Changing the Attack Trigger

So here are the new Animator settings for one the Attack exit transitions. Note the addition of the Walking parameter. We need to tell Attack which State it should transition toward. The transition to Idle will be the same except the Walking flag will check for a False condition.

Set up the Exit transitions to work with the new Parameter.

I switched up the Attack method of the Zombie Animator to work with a Boolean flag.

At least one part of the solution is to remove the stopping distance parameter from Follow Target.

FOUND IT!

OMG GUYS! GUYS! The bug was in the Aggression component! There are TWO ways that Follow Target gets set:

  1. A Target is found by the Search for Targets component.
  2. A Target is found because we got slapped and the Aggression component is upset.

So the bug was that the Dragon wasn’t entering the Attack component at all. It did not have a target. The overrun was caused because a Target wasn’t being sent to Attack until the Aggression component reduced Hate to 0.

Sneaky BUG! You cost me two hours and some lost sleep!
And unnecessary code changes, probably for the better though.

Animator Override Controllers

I totally forgot about these gems! May the Great TechnoWizard look kindly upon the designers of this Feature!

To use an Animator Override Controller you drag in the Controller you want to override and then drag in the animations you want to replace.

Not replacing an animation will use the original animation, so keep that in mind.

Happy
Happy
0 %
Sad
Sad
0 %
Excited
Excited
0 %
Sleppy
Sleppy
0 %
Angry
Angry
0 %
Surprise
Surprise
0 %

Average Rating

5 Star
0%
4 Star
0%
3 Star
0%
2 Star
0%
1 Star
0%

Leave a Reply

Your email address will not be published. Required fields are marked *