Backup your project before importing any of the asset updates!
This update of the Motion Controller and its motion packs represents a pretty large change in how the assets work together. The goal of the update is to make the assets easier to use and introduce features that help you customize your gameplay.
This update is a BREAKING CHANGE. That means that you will need to make changes to your existing Motion Controller enabled game to take advantage of the new changes and features. I try not to do this too often, but sometimes you have to in order to move forward.
- Simpler approach to motion packs
- Simpler approach to adding and changing animations
- Simpler approach to using multiple layers for things like ‘shooting while walking’
- Introduction of states for easier customization
- Introduction of ‘Reactors’ for easier customization
- Introduction of Unity Events for easier customization
- Introduction of new message flow for combat
- Ability to lock-on with the archery motion pack
- New approach to generating sub-state machines
Check out this video for a quick intro to the update:
Less motions and more features
Previously, when you had all the motions packs your motion list would become huge. We had an idle motion for each pack, a walk motion for each pack, etc. It got pretty long and each “idle” was its own logic (which was mostly just a copy of the original Idle motion).
Now, we can have one core “Basic Idle” script that can handle any idle animation. What used to take 31 different motions can now can be done in 11:
That said, you can still go back to overriding the “basic” motions with your own custom idle, walk, jump, etc.
Mixing layers creates advanced actions
The MC has always supported multiple layers. However, this update really streamlines that approach for melee and ranged attacks. If you want to be able to walk and shoot at the same time, just add the Basic Ranged Attack motion to the second layer.
By having a Basic Walk Run motion on the first layer and the Basic Ranged Attack motion on the second layer, your character will run both motions at the same time. This means you can shoot while walking.
Add the Basic Equip motion to the second layer and you can equip your weapons while walking.
Add the Basic Melee Attack to the second layer and you can swing your weapon while walking.
Note: Not all animations are built to support layers. For example, the spine of the walking animation may not be rotated in the direction the spine of the shooting animation expects. Finding the right animations or adding animation specific IK can make a huge difference.
IK tools like the Bone Controller or Final IK can help you to rotate the bones.
Add new animations with no code changes
While the traditional way of having a sub-state machine per motion is still valid, I’ve added the ability to have multiple animations for a single motion. You can now add a new set of animations without changing any code.
For example, let’s look at the new Basic Walk Run Pivot motion.
Typically the sub-state machine would have a single flow (like an unarmed movement blend tree). We can now have multiple flows for the same motion and we can change which flow occurs at run-time.
- Unarmed movement
- Sword & Shield movement
- Archery movement
- Spell Casting movement
- And others…
We could add a blend tree for “Female unarmed movement” or “Staff movement” without changing any code.
The best way to think of it is like this… The motions represent an action (like walking). The motion code for the action is the same. However, the “form” allows you to determine which animation to use and therefore how you’ll walk.
Custom states for custom characters
Core to managing any character is understanding what state that character is in. The Actor Core now allows you to create custom states that are accessible from the MC, AI, and other components.
However, you can add as many states as you need for your custom AI.
Customize game-play using Reactors
Reactors are a new feature of the Actor Core that allow you to tap into the flow of combat, motions, and other tasks to customize how your game works.
Some of these actions may be as simple as writing text to the console for debugging or something more gameplay specific like choosing which attack to make next.
Create custom reactors to fit your game’s specific needs:
Or, simply pass the message on to a custom function using Unity’s standard events:
Tap in with Unity Events
In addition to reactors, you can also customize gameplay by tapping into events from the Motion Controller, Basic Inventory, Camera Controller, and other assets (more coming).
However, you can also tap into the events directly at the source. This gives you a way to watch for when motions are activated, weapons are equipped, or camera views have changed.
Use these Unity Events directly or funnel the messages all through to intelligent reactors. It’s your choice.
Target locking from anywhere
The Combatant now lets us lock onto a target from any motion. We can use its updated features to force the character to rotate to the target and control the camera’s direction as well.
Like before, we can control which stances allow a lock.
Use the Target Locked and Target Unlocked events to trigger custom code as the character locks-on to a target.