Animal Controller
📥 Integrations📑 Changelog✅Social
  • 🤝Welcome to Malbers Animations Assets
  • 🌐Discover all my Assets
  • 💫What's New
  • 🌀Upcoming assets
  • 📋Changelog
  • ↗️Upcoming Changelog
  • 🛣️Road Map
  • ✍️End User Licence Agreement
  • 🌟Features
  • Improve Performance Tricks
  • 😓Know Limitations so far
  • 📥Downloads
  • QuickStart
    • 📖Guide to use All Malbers Assets with (AC)
    • 🔼Upgrade to URP
    • 🔼Upgrade to HDRP
    • 💔Common Issues
    • 🔔Tips and Tricks
  • Guides and Tutorials
  • 📺YouTube Tutorials
    • 📺Video Tutorials (On Queue)
  • 📱Mobile Setup Guide
    • Mobile Joystick
  • 🧐How to: Animal Controller
    • 🔹Play a Mode while Moving
    • 🔹Create and configure a new mode
    • 🔊Adding Sound Effects
    • 🔹Rebone Mesh Tutorial (Skin Mesh is Missing)
    • 🔹Add Movement with Non RootMotion Animations
    • 🔹Fetch a ball
    • 🔹Set up Timeline
    • 🔹Make Animal flee when see the animal Player
    • 🔹Animal Controller for Humanoids
    • Create a Shootable Weapon From Scratch
    • ⚔️How to Fix weapons offset and values (Bow, Pistol)
    • ✨Add a Effect to the Effect Manager
    • 🕹️Connect Inputs to the Controller
    • Modify the controller with a Stat
    • Use the Modify Stat Component
    • 📡Use a MEvent and MEvent Listeners
    • 💎Change from Faceted to Smooth poly art Animals
    • ⁉️Listen when an Mode starts or ends
  • 🐎How to: Horse Animset Pro
    • 🐴Call the Mount
    • 🤠Change Meshes for the Rider
    • 🏇Make any animal mountable
  • 🕺Strafing
  • Main Components
    • 🐺MAnimal Controller
      • General
        • Pivots
      • Speeds
      • 🔷States
        • 🕴️Idle
        • 🏃‍♂️Locomotion
        • 🌠Fall
        • 🤾‍♀️Basic Jump
        • 🤾‍♂️Root Motion Jump
        • 🐟Swim
        • 🐊UnderWater
        • 🧗‍♂️Climb
        • 🧗‍♂️Ledge Grab
        • 🦅Fly
        • 🪂Glide
        • 🧗Wall Run
        • 🧗Wall Run Vertical
        • ⛷️Slide
        • ☠️Death
        • ☠️Death Ragdoll
        • 🆕Creating a new State
      • 🟩Modes
        • 🟩Mode Behavior
        • 🟩Mode Sequence
      • 🅾️Stances
      • Advanced
      • Animal Modifiers
      • Events
      • Debug
      • Animal Animator Behaviors
      • Methods and Properties
    • 🎮Malbers Input & MInput
      • Methods and Properties
    • 🤖AI
      • AI Animal Control
      • MWayPoint
      • Wander Area
      • AI Target
      • Animal Brain
        • AI States
        • Tasks
          • General - Chance
          • General - Empty
          • General - Invoke Event
          • General - Send Message
          • General - Play Audio
          • General - Quick Align
          • General - Reaction
          • General - Set Look At Aim
          • General - Set Stat
          • General - Wait
          • Animal - Set Speed
          • Animal - Play Mode
          • Animal - Set/Play State
          • Animal - Set Stance
          • Animal - Set Strafe
          • Movement - Move Stop
          • Movement - Patrol
          • Movement - Set Destination
          • Movement - Set Target
          • Variables - Set Var Listener
          • Weapons - Weapon Tasks
        • Decisions
          • General - AND
          • General - Check Stat
          • General - Compare Stats
          • General - Look
          • General - OR
          • General - Is Task Done?
          • General - Wait
          • Movement - Has Arrived
          • Movement - Check Target
          • Animal - Check Mode
          • Animal - Check Stance
          • Animal - Check State
          • Variables - Check Scriptable Variable
          • Variables - Check Transform Var
          • Variables - Check Var Listener
          • Runtime Set - Is Target in Runtime Set
      • 📌Point Click
    • 🧨Reactions
    • 📶Combo Manager
    • ⚔️Weapon Manager
      • 🛡️MWeapon [General] Properties
      • 🛡️MWeapon [Damage] Properties
      • 🛡️MWeapon [IK] Properties
      • ⚔️MMelee
      • 🔫MShooteable
      • 🏹Bow
    • 〰️Path Constraint
      • 〰️MPath
      • 〰️Path Link (Straight)
      • 〰️Path Link (Cinemachine Path)
      • 〰️Path Creator(Sebastian Lague)
    • Speed Ground Changer
  • Scriptable Architecture
    • 💠Scriptables
      • 🔹Bool Var
      • 🔹Int Var
      • 🔹Float Var
      • 🔹String Var
      • 🔹ValueToString
      • 🔢Variable Listeners & Comparers
      • 🔰IDs
      • 🎫Tags
      • 🪝Transform Hook
      • 📣MEvents
      • 📣MEvent Listener
      • 📦Runtime gameobjects
    • 🔤MLocal Variables
  • Secondary Components
    • ⚔️MDamager
      • 🐾MAttack Trigger
      • 🐾Attack Trigger Behavior
      • 🏉MProjectile
      • 🏹Projectile Thrower
      • 🤯MExplosion
    • 🤕MDamageable
    • 🧊Zones
      • Public Methods
    • ✊Pick Up - Drop
    • ✊Pickable
    • 🚩Respawner
    • 🚩Respawner NPC
    • 🚩Simple Respawner
    • 🏁CheckPoint
    • IK Manager
      • IK Processors
      • Weight Processors
  • Global Components
    • 🧡Stats
      • 🔸Stat Modifier
      • 🔸Modify Stat <Component>
      • 🔸Modify Stat <Asset>
      • 👨‍💻Public Methods
    • Animator Behaviours
      • Message Behaviour
      • Random Behaviour
      • Is Kinematic Behaviour
      • Sound Behaviour
      • Rigid Constraint Behaviour
    • 🟩Trigger Proxy
    • 🔌Interactable
    • ⚡Interactor
    • ⁉️Conditions
    • 🎥Free Look Camera
    • 🎥Cinemachine
    • UI
      • Unity Utils
  • Riding System (HAP)
    • Horse Animset Pro (HAP) Riding System
    • The Art of (HAP)
    • Mount
      • Methods and Properties
    • MRider
      • Methods and Properties
    • Mount Triggers
    • Mount Points
  • Utilities
    • Material Changer
    • Active Meshes
    • Effect Manager
    • Effect Behavior
    • Animator Event Sounds
    • Blend Shapes
      • Blend Shape Preset
    • Look At
    • 🏹Aim
    • 🎯Aim Target
    • 🎯Lock On Target
    • 🐾Steps Manager
    • 🐾Step Trigger
    • 🔗Mode Align
    • 🔗Aligner
    • Component Selector
    • MAnimalAnimatorSync
    • Multiple Time Checker
    • MAnimalAnimatorSync
  • Annex
    • 🗃️Integrations
      • General HAP Integration
      • Rewired
      • Invector Templates
        • Invector Weapon Settings
      • Animals Controller + Invector
      • Ootii's Motion Controller
      • Opsive Ultimate Character Controller (UCC 3.03)
      • Opsive Ultimate Character Controller (UCC 3.08) Generic
      • AStar Pathfinding
      • Unity Input System (NEW)
        • New Input Link [Old Versions]
      • Game Creator
      • Game Kit Controller
    • Contact
    • 🤔FAQ
    • Refund Policy
  • Games using Malbers Animations
  • Interfaces
    • IAITarget
    • IWayPoint
    • IAIControl
    • IAim
    • IAlign
    • IGravity
    • IInteractor
  • ULTIMATE SELECTOR
    • Overview
    • Selector Manager
    • Selector Editor
    • Selector Controller
    • Selector Item
    • Selector UI
    • Selector Data
    • Changelog (Selector)
  • 🎒Malbers Inventory Add-On
    • Overview
      • Compatibility Matrix
      • Roadmap
      • Update Notes
  • Updating from v1.1.1 to v1.2 Instructions
  • Basic Setup Instructions
    • Creating a new Item
      • Adding Buffs/Debuffs to Items
      • Setting up Item Reactions
      • Custom Rarities
    • Setting up Item/Inventory Types
    • Set up the Pick/Drop Component
    • Setting up the Notifications
    • Setting up the Item Info panel
  • Inventory Set
    • Events
  • Inventory Master
  • Notification Manager
    • Notification Child
    • Events
  • Save/Load System
  • Item Spawner
  • Storage Chests
    • Chest Inventory
    • Chest Inventory UI
  • Using Armour
  • Shop System
    • Shop
    • Shop UI Manager
  • Cooking System
    • Create a new Recipe
  • UI Manager
  • Hotbar
Powered by GitBook
On this page
  • Preparing the scene
  • Making Invector to Hit the Animals
  • Projectiles
  • Making the animal to hurt Invector
  • Setting Invector Character as the Main Player
  • Checking when Invector Character dies
  • Animal AI States
  • 01 AC Patrol
  • 02 Attack and Kill
  • 03 Find who hurt me
  • Setting the Waypoints as patrol route

Was this helpful?

  1. Annex
  2. Integrations

Animals Controller + Invector

✔

PreviousInvector Weapon SettingsNextOotii's Motion Controller

Last updated 4 years ago

Was this helpful?

Let's make any creature controlled by the Animal Controller to attack the Invector character.

For this quick guide I'll be using the Poly Art Wolf and the Animal Controller, along with Invector Melee template.

If you are using the Horse animset pro Integration, by default all the Melee weapons can hurt any of my creatures.

Preparing the scene

For a quick Environment; prepare a simple scene with the Invector Character, the Wolf Enemy AI prefab. As the Ground use a simple plane.

  • Set the Plane as Navigation Static and bake the Navigation Mesh, so the AI wolf can walk around.

  • Create 2 or more Waypoints connected to each other.

Waypoint 1 <next target> will be Waypoint 2, Waypoint 2 <next target> will be Waypoint 3.. and so on

This will be the patrol route for the wolf to walk.

Making Invector to Hit the Animals

Make sure you add the Animal Layer to the Damage Layers on the Shooter/Melee Manager

By Default all Invector's weapons can hurt the animals like the horse. But for small animals, When the Player is swinging the melee weapon, the HitBoxes of that weapon will miss small animals.

This is solved by Increasing that Hit Box collider on Each Weapon

Projectiles

All projectiles should have the Damage Malbers component attached to it an connected to the VDamage Event.

In case of the Arrows add the Damage Malbers Component to the Animated Arrow GameObject and set the Stat you want to affect.

Connect the DamageMalbers.DealDamage method to the Arrow Projectile On Pass damage Event

Do the same for the bullets prefabs

Making the animal to hurt Invector

In order for the animal to make damage to the invector character:

  • We need to add to each Attack Trigger, the VObject Damage component from invector:

  • On the MAttack Trigger Component, use the On Attack Begin && On Attack End events to enable and Disable the VObject Damage script.

  • Make sure the VObject Damage component is disabled by default

Do the same for all Attack Triggers that the animal has. In case of the Poly Art wolf, repeat this step for the Mouth Attack Trigger.

Setting Invector Character as the Main Player

The fastest way to create a Global reference, that can be recognized by the Brain component of the Animal, is adding a Transform Hook.

  • Add the Transform Hook Component to Invectors Character

  • As Hook use the <Player> Asset and as Reference, leave it as the Root of the Character.

Use also the AI Target component to set the Stopping distance for the Character. That way the animal will stop when it gets to the stopping radius.

Checking when Invector Character dies

We need to let the animal knows when the character dies. Luckily Invector has a public unity Event that is invoked when the character is death. We can use this to store a bool value for the Death into a Bool Var Listener component.

  • Add a bool var listener component to Invectors Character. Set the Value to false and the ID to 10

You can add a description to any Var Listener component with the context menu -> Show Description

  • Connect the On Death Event from the Invector Third Person Controller to the bool Var Listener

Using the BoolVarListener.Value = true

That way we can store the Death value and use it on the Animal Brain AI States.

Animal AI States

Finally we need to have the AI States, Tasks and Decisions needed to make a simple Enemy behaviour for the Animal.

To check which current state is using the Animal you can select the AI gameObject inside the animal hierarchy and find the Brain Component.

We can use as a base the States given on the Enemy samples.

01 AC Patrol

This AI State will execute the Patrol behaviour on the waypoints we create on the scenes.

As for the decisions we need to modify Look for Player. Instead of searching for the Animal Player, search for a Transform Var and set the Player asset as the Value.

02 Attack and Kill

This state is in charge of Playing the Attack animations near the current target the Ai Animal has.

In this AI State, we can't use the default <Is Target Death> decision. Since this decision is use only for characters that uses the Animal Controller.

Instead, create a new Decision, this time a <CheckVarListener> decision. We will be checking if the target has a bool var Listener and if its value has changed to true. Which means the Invector Character is death.

You can create a new Decision using the Create context menu on the project window.

03 Find who hurt me

This state is use in case the animal has suffer any damage, so it looks if the player is near him, and if is near then it will go to the Attack State.

For this state, the <Is Player near me> decision needs to be modified too, just like the <Look for Player> Decision in the first AI State.

Setting the Waypoints as patrol route

Finally select the animal, and on the AI GameObject, set any of the waypoints to the first Target on the AIANimal Control component

And that's it, that way the animal can attack Invector's Character.

Changing this we will be looking for the Player Hook we created earlier

Specify the Listener ID to be equal to 10 so matches the ID we set ↑.

🗃️
↑
before