Friends, food, and flourishing

A MalberS sprinting kitty

A note to myself about making a kitty sprint with MalberS when you hold down shift. Note: I’m not an expert. There may be better ways of doing thing.

The kitty is from RedDeer:

Kitty

The kitty’s animator controller has a 2D Cartesian blend tree for locomotion (another article talks about setting up walking):

Blend tree

There are four speeds:

  • Walk forward (Pos Y is 1)
  • Walk backward (Pos Y is -1)
  • Trot forward (Pos Y is 2)
  • Sprint forward (Pos Y is 3)

I’m using root motion animations, so the Pos Y values are more for identifying animations, rather than setting the actual speed.

I added sprint to the Malbers input component. You also need to set the event that the sprint key triggers:

Input sprint event

Left shift triggers sprint. When it’s changed (pressed or released), the MAnimal.Sprint event happens, on the player’s cat.

Finally, check the animal controllers’ locomotion state sprint tag:

Animal controller tags sprint

I don’t know what this does, but it’s needed.

Now I have a walking and sprinting kitty. It goes into trot momentarily as it’s speeding up and slowing down.

Leave a Reply

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

css.php