AnimationSDX Class

Parent Previous Next

The Animation SDX mod relies on a new class called "AnimationSDX". It exposes Unity calls that allow us to add in assets with custom animations, which we can control through the XML files.


Originally, there was separate classes for animals vs BipedAnimations, however, there's little need for the BipedAnimations class anymore, so we are funneling everything through the AnimalAnimationSDX.



Using the Animation SDX class, with a new custom Unity asset, we can make calls directly to the embedded animation in the unity3d file.


For example, in the Red Samurai How To, we had a few existing animations:



By using the animation names in the Elements, we can populate the following new properties in the XML.


        <!-- These are the animation map names. The value comes from the animation from Unity -->

       <property name="AnimationIdle" value="Idle" />

       <property name="AnimationSecondIdle" value="Idle2" />

       <property name="AnimationMainAttack" value="Attack(2)" />

       <property name="AnimationSecondAttack" value="Attack(3)" />

       <property name="AnimationPain" value="Get_Hit" />

       <property name="AnimationJump" value="Jump" />

       <property name="AnimationDeath" value="Dead" />

       <property name="AnimationRun" value="Run" />

       <property name="AnimationWalk" value="Walk" />

       <property name="AnimationSpecialAttack" value="Attack(4)" />


The above properties are what is currently supported by the Animation class. Some are optional, such as AnimationSpecialAttack, AnimationSecondAttack, etc. However, it's best to try to populate them as best as you can for a full experience.



When compiled, a new entity_class is added to the entityclasses.xml called "SDXTemplate". All new entities that want to use this class should inherit from this, or copy it's attributes


       <entity_class name="SDXTemplate" extends="zombieTemplateMale">


               <!-- For fun, let's use the zombie transmogrifier class -->

               <property name="Class" value="EntityZombieSDX, Mods" />


               <!-- We are using the Animal Animation, since the BipedAnimation is a bit wonky with the hit animation -->

               <property name="AvatarController" value="AnimationSDX, Mods" />


               <!-- With RootMotion true, the zombie just kind of chills out in one place. Set to false to watch it move. -->

               <property name="RootMotion" value="false" />


               <!-- Baseline Speed is way too slow, so we need to bump it up a notch or 5 -->

               <property name="WanderSpeed" value="0.8" />

               <property name="ApproachSpeed" value="0.8" />

               <property name="NightWanderSpeed" value="0.8" />

               <property name="NightApproachSpeed" value="1.1" />

               <property name="HasRagdoll" value="false" />

       </entity_class>


This changes the Class to use the ZombieTransmogrifier mod. However, you can change this back to the regular zombie class.


The AvatarController is already pointing to the AnimationSDX class.


RootMotion is disabled, as it causes the new entities to not move around if its enabled.


We bump up the default speeds, as there are internal modifiers that affect the zombie speeds that are not available to the new AvatarController.



Created with the Personal Edition of HelpNDoc: Free Qt Help documentation generator