Search Unity

Motion Controller

Discussion in 'Assets and Asset Store' started by Tryz, Feb 21, 2014.

  1. TeagansDad

    TeagansDad

    Joined:
    Nov 17, 2012
    Posts:
    871
    If you're modifying the value of the Health attribute directly, you'll need to trigger the damaged or death animation manually as well.

    The BasicDamagedReactor will process any DamageMessages received by the character's ActorCore. If you want to work within the existing patterns for handling this, you could send a DamageMessage instead of modifying the attribute directly. Something like:

    Code (CSharp):
    1. void InflictDamage(GameObject rTarget, float rDamageAmount)
    2.         {
    3.             ActorCore lActorCore = rTarget.GetComponent<ActorCore>();
    4.             if (lActorCore == null) { return; }
    5.  
    6.             DamageMessage lMessage = DamageMessage.Allocate();          
    7.             lMessage.Damage = rDamageAmount;
    8.             lMessage.AnimationEnabled = true;
    9.  
    10.             lActorCore.SendMessage(lMessage);
    11.         }
     
    StayUpLate likes this.
  2. StayUpLate

    StayUpLate

    Joined:
    Jul 29, 2018
    Posts:
    58
    This does the trick! Thanks!
     
    TeagansDad likes this.
  3. paifu

    paifu

    Joined:
    Jul 15, 2012
    Posts:
    20
    Hello, I have my enemies with their own character controllers, if I need to intercept or send ootii combat messages, what should I integrate into my custom script?
     
  4. Weblox

    Weblox

    Joined:
    Apr 11, 2016
    Posts:
    256
    Anyone using Emerald AI in their Project? There is an Integration Tutorial available here , but it does not mention the Spellcasting Motion Pack, so I wanted to make sure the Integration will work before modifying the Core files.
    Also, is the Inventory Pro Integration still up to date ?

    Thanks in advance.
     
  5. Salja

    Salja

    Joined:
    Mar 23, 2017
    Posts:
    326
    Watch my Name in emeraldai Forum Post i made a own Integration for it with working spell Casting and not changing core files
     
    Tryz and Weblox like this.
  6. Tryz

    Tryz

    Joined:
    Apr 22, 2013
    Posts:
    3,229
    Don't forget to release the message after you send it. :)

    Code (CSharp):
    1. DamageMessage.Release(lMessage);
     
    StayUpLate and TeagansDad like this.
  7. Tryz

    Tryz

    Joined:
    Apr 22, 2013
    Posts:
    3,229
    If your character has an ActorCore on it, I'll send the combat messages to that. Then, you can customize what you want to do with Reactors.

    If you don't want to use the ActorCore, you need to create a component that implements my IDamageable interface. Then, I'll send the hit message to that.

    The IDamageable interface has one function you'll need to implement:
    Code (CSharp):
    1. bool OnDamaged(DamageMessage rMessage);
     
  8. Weblox

    Weblox

    Joined:
    Apr 11, 2016
    Posts:
    256
    @Salja - Awesome, I found it here . I hope I can try it out tonight. Thanx a lot. Also you got a nice game going, I really like the Evasion Jumps your Character has. Are you using Kubolds Animation Packs?
     
    Salja and Tryz like this.
  9. Tryz

    Tryz

    Joined:
    Apr 22, 2013
    Posts:
    3,229
    I think what you're saying makes sense. You can probably create that "target" pretty easily by using the view direction of the camera to determine the position of the target object.

    The tricky part is that the motions in the MC will typically want to rotate the character for you if that option is on. That means you'll need to disable and re-enable the option as you see fit (based on the angle you care about). It's an easy thing... just grab the motion and set the IsEnabled property. You just have to manage when.

    Yes.

    I like the idea. I'm just not sure how you'd do that (isolate the character). This one is one of those tasks you just have to play with and see what happens.

    The attacks are based on the weapon swings. So, if your character's swing ends up being in the direction of the camera (due to IK or something), you're fine. You really can't disconnect it from the swing... well... I haven't tried to. ;)
     
  10. Salja

    Salja

    Joined:
    Mar 23, 2017
    Posts:
    326
    Yeah i use for some npcs kubold animations
     
    Weblox likes this.
  11. Salja

    Salja

    Joined:
    Mar 23, 2017
    Posts:
    326
    I made sometime ago a slowmo effect you can use this asset for is perfect for what you need https://www.assetstore.unity3d.com/en/?stay#!/content/31225 here a old video just the npcs will slow
     
  12. AndyNeoman

    AndyNeoman

    Joined:
    Sep 28, 2014
    Posts:
    877
    Hi @Tryz , Is there a way to disable movement when the player reaches the terrain edge. When I have used a basic controller I just used a box collider but i was just wondering if there was something built into the motion controller.
     
  13. Tryz

    Tryz

    Joined:
    Apr 22, 2013
    Posts:
    3,229
    A box collider is still the right option.
     
    AndyNeoman likes this.
  14. Salja

    Salja

    Joined:
    Mar 23, 2017
    Posts:
    326
    Character Wizard Camera issue.

    I get a Camara Issue at Sword and Shield Pack (Camera moves after Attack motion) if i setup the character with the Character Wizard, if i setup the old way i don´t have the issue

     
  15. TeagansDad

    TeagansDad

    Joined:
    Nov 17, 2012
    Posts:
    871
    Is it creating a Camera Anchor object? If so, try disabling the Anchor and assign the player as the camera target. The normal way doesn't use the camera anchor, but I have it as an option in the Wizard.
     
  16. witcher101

    witcher101

    Joined:
    Sep 9, 2015
    Posts:
    489
    Does this has a 1st person mode as well??
     
  17. Tryz

    Tryz

    Joined:
    Apr 22, 2013
    Posts:
    3,229
    Check out this post as it explains how it can be used with 1st person and design issues you have to think about.

    Motion Controller and First Person Games
     
  18. Salja

    Salja

    Joined:
    Mar 23, 2017
    Posts:
    326
    yeah he has, but i delete and still the same issue must be come from a other settings or component
     
  19. TeagansDad

    TeagansDad

    Joined:
    Nov 17, 2012
    Posts:
    871
    Can you PM me your scene file? Also, did you use a custom profile in the CW or one of the defaults?
     
  20. Salja

    Salja

    Joined:
    Mar 23, 2017
    Posts:
    326
    Done, i don´t use a custom profile, unity is frsh installed and just ootii with all default settings
     
  21. StayUpLate

    StayUpLate

    Joined:
    Jul 29, 2018
    Posts:
    58
    I believe we have some FL people here. For everyone (or with loved ones) in the storm's path; hope you're all ok! Stay safe.
     
    Salja, hopeful, rubble1 and 1 other person like this.
  22. Necka_

    Necka_

    Joined:
    Jan 22, 2018
    Posts:
    430
    Hi there,

    I hope this is a simple question with a simple outcome :)

    I'm playing around with Behaviour Designer and wanted to test a very simple thing:

    Npc walks to Waypoint 1, Play a look around animation, goes to waypoint 2 and play another look around animation

    So obviously it doesn't work just by playing an animator state as MC has control and will shutdown the animation straight away the animation to go back to IDLE

    There is no action in B.D to disable Motion Controller on the object

    Then I thought I'll use simple motion for playing those animations and in B.D use the "Activate motion" task. Nope.. Simple motion is a unique motion so I couldn't use it for multiple animation even though I can have multiple "Simple Motion" on my NPC, the name of the motion is still the same

    I thought then I could duplicate the Simple Motion script and create multiple ones. But it puts an error if I rename the Public class (remember I'm not a coder so I might just miss something simple)

    Anyway, here I am :) Any help would be appreciated
     
  23. Tryz

    Tryz

    Joined:
    Apr 22, 2013
    Posts:
    3,229
    You can rename the motions. Then, you can use the MC's GetMotion(int rLayerIndex, string rName) function to get the motion with the specific name.



    I don't remember if my BD integration has an ActivateMotion node that uses a name, but I think it does.
     
  24. TeagansDad

    TeagansDad

    Joined:
    Nov 17, 2012
    Posts:
    871
    @Necka_ - Try playing those simple animations directly (bypassing Motion Controller), but put them all on a new animator layer at the bottom of the list. You might need to create a full body avatar mask for this layer (I can't remember if I did). Make sure the layer is set to Override blend mode and Weight 1. Just make sure you only play animations here when the character is not moving, or you might see some odd behavior. ;)

    You can also use a simple script to change the animation played by SimpleMotion at runtime. I know you're not a coder... Does bolt let you call functions on components?
     
    Tryz likes this.
  25. tchris

    tchris

    Joined:
    Oct 10, 2012
    Posts:
    114
    This is the Behavior Designer task for activating a motion I was using. I'm not sure if I got this from the Ooti Vault or not but here it is :)

    Code (CSharp):
    1. using UnityEngine;
    2. using BehaviorDesigner.Runtime;
    3. using BehaviorDesigner.Runtime.Tasks;
    4. using com.ootii.Actors.AnimationControllers;
    5.  
    6.  
    7. [TaskCategory("Basic/Motions")]
    8. [TaskDescription("Activate Motions")]
    9. public class ActivateMotion : Action
    10. {
    11.  
    12. public SharedGameObject targetGameObject;
    13. public string motionName;
    14. private MotionController mMotionController = null;
    15. private GameObject prevGameObject;
    16.  
    17. public override void OnStart()
    18. {
    19. var currentGameObject = GetDefaultGameObject(targetGameObject.Value);
    20. if (currentGameObject != prevGameObject)
    21. {
    22. mMotionController = currentGameObject.GetComponent<MotionController>();
    23. prevGameObject = currentGameObject;
    24. }
    25. }
    26.  
    27. public override TaskStatus OnUpdate()
    28. {
    29. if (mMotionController == null)
    30. {
    31. Debug.LogWarning("mMotionController is null");
    32. return TaskStatus.Failure;
    33. }
    34. MotionControllerMotion motion = mMotionController.GetMotion(motionName);          
    35. mMotionController.ActivateMotion(motion);
    36. return TaskStatus.Success;
    37. }
    38.  
    39. public override void OnReset()
    40. {
    41. targetGameObject = null;
    42.  
    43. }
    44. }
    45.  
     
    Tryz likes this.
  26. Necka_

    Necka_

    Joined:
    Jan 22, 2018
    Posts:
    430
    Yes Bolt let me call functions on components

    I like the idea of having the animations on a separate layer and override MC animations then, that might also be cleaner than creating a lot of simple motions :)
     
    Tryz likes this.
  27. Necka_

    Necka_

    Joined:
    Jan 22, 2018
    Posts:
    430
    Thank you for this, as I might use Teagansdad trick, that is important information for me :)
     
    Tryz likes this.
  28. Weblox

    Weblox

    Joined:
    Apr 11, 2016
    Posts:
    256
    Hi @Tryz - So I have been playing some more with the MC and got the Sword and Shield, Archery and Spellcasting Packs installed. Everything is working nicely up to this point. Watching the videos I see Assets that I don't seem to have all the Assets (like the goblins and the fantasy character or the Jones Character from Malbers Integration video.) Should I have those anywhere in my Project too?

    For the Integration with RE4 Effects I have some Issues with the Water Dragon not causing damage and also the fireSpout seems to be visually broken for me. I am not entirely sure, but the Integration Package seems to contain an empty Prefab ("Character Controller Spell"). I am using the "SCMP_Krypto_20170624" Integration Package. See attached video for the original Effect11 working nicely in the scene while the FireSpout spell has misaligned elements. How can I fix this?


    @Salja - I am using Emerald with your Integration script and everything is working well with the Sword and Shield & Archery Packages. Spellcasting works good for Projectile Spells also, but AoE Spells do not seem to apply damage (Poisonous Fog) and Target Spells don't let me target (highlight) Emerald Agents. Am I missing something here?

    @Malbers - I also try to use the latest Integration from this post but it's giving me some hard time to get started. There are missing prefabs from the demo scenes and the existing Prefabs do not seem to work. I have attached a small video showing the Issue. Please note the Gizmo showing up in the Scene view when selecting any of the Prefabs. Also note the Unity Message about broken Prefabs and that Prefabs can't be dragged in the Scene or Hierarchy view.


    As always, Thanks in advance. Any help is much appreciated.
     
    Last edited: Oct 14, 2018
  29. Tryz

    Tryz

    Joined:
    Apr 22, 2013
    Posts:
    3,229
    Good stuff.

    Art assets like the goblin, Jones, or The Challenger aren't things I would give away in my code-based assets. I just use them for pictures and videos because it's nicer to see those than my orange robot. Fortunately, you can get Jones out of Mixamo's Fuse tool and The Challenger from Unity in the asset store :)

    Water Dragon isn't supposed to cause damage. If you look at the spell nodes, you won't see any nodes that cause damage. Instead, I knock the characters down and reduce their Strength attribute.

    This was just the way I chose to create the spell. You can modify it as needed for your own custom spells.

    Since that's inside the FX part of the spell, I don't know.

    The goal of this free package was to show you that you could use external FX packages with the Spell Casting Motion Pack. However, how those particle effects work is really up to the FX package itself. In the spell, I just spawn his prefab:



    Unfortunately, I can't really give support on his asset. You may find there's a little bit of "bridge" code needed for some of his effects. I know I need to do that with the "RE4 Modifier" you see above.

    You may need something specific for this effect.
     
    Weblox likes this.
  30. paifu

    paifu

    Joined:
    Jul 15, 2012
    Posts:
    20
    Hello i use the ootii camera contoller on 3rdperson style, the 3rd Follow person follow mode is reacting well like attached by a rope behind the character but if I go towards the camera, the camera seem push back and not rotating and positioning itseff behind the character. What can I do if i want the camera to do a transition going behind the character after a movement? Thanks
     
  31. Tryz

    Tryz

    Joined:
    Apr 22, 2013
    Posts:
    3,229
    That's the way the 3rd person motors are built. If you walk towards the camera, the motor will push itself back to respect the "Distance" property.

    Eventually as you push into the camera, it will get pushed around to the side and then behind the character where the character will then pull the camera again.

    This is pretty standard for Tomb Raider and Assassin's Creed (which is what I modeled them after).

    I think what you're asking for is the camera to stay in place when the character walks into it and just have it rotate. Then, the character would walk past the camera and start to pull it again. Unfortunately, the 3rd person motors weren't built that way. You'd have to create a custom camera motor to have that behavior. Totally doable, but there's coding involved.
     
  32. paifu

    paifu

    Joined:
    Jul 15, 2012
    Posts:
    20
    I understand, is there a way to stay always on targeting mode? This mode could work for me, like in Skyrim where the character is always strafing facing his target.
     
  33. TeagansDad

    TeagansDad

    Joined:
    Nov 17, 2012
    Posts:
    871
    Disable BasicWalkRunPivot and just use BasicWalkRunStrafe. You'll need to make sure that Require Aim isn't checked.
     
    Tryz likes this.
  34. paifu

    paifu

    Joined:
    Jul 15, 2012
    Posts:
    20
    Thanks for your solution, seems pretty straightforward. But I can't find the option Require Aim, where is it located? The character stay stuck at the moment if I deactivate BasicWalkRunPivot.
     
  35. TeagansDad

    TeagansDad

    Joined:
    Nov 17, 2012
    Posts:
    871
    Sorry, the checkbox is "Activate with Target" -- I wasn't on a computer when I responded and didn't have time to double check. :)

    upload_2018-10-15_9-37-24.png
     
  36. paifu

    paifu

    Joined:
    Jul 15, 2012
    Posts:
    20
    This is working perfectly!, Thanks a bunch.
     
    Tryz, TeagansDad and hopeful like this.
  37. TeagansDad

    TeagansDad

    Joined:
    Nov 17, 2012
    Posts:
    871
    You're welcome!
     
  38. Weblox

    Weblox

    Joined:
    Apr 11, 2016
    Posts:
    256
    Hi @Tryz

    I understand. Looking at the Water Dragon Spell in the Spell Editor I see a "KnockedDown" motion, that should be triggered on the targets. As you can see in the video, this doesn't happen also.


    That made me look at all the other default spells in the spell editor and realized that none of the Activated Motions on spell targets seem to fire off. I made some more videos in the demo scene to Illustrate the issues. Please see the attached playlist. I assume that I am doing something wrong here, or have missed the setup at one step? How can I make sure, the spells will work as expected?


    Well, that is a little sad to hear, since I assumed the Integration Packages on the Vault would be considered "Official Integrations" and also updated to work with the latest Asset Versions. So far I did not have much luck with any of the Integration Packages from the Vault, but I still have to try Inventory Pro, which is next on my to-do the list.

    Speaking of Integrations, any help with the Emerald AI and HAP 3 Integration Packages still is greatly appreciated.

    I do of course understand, that it's hard to support Unity Beginners with all sorts of help requests, but I really hope to overcome all the starting Issues and get a solid base for my new Project with all the needed Integration working.

    Thanks in advance and keep up the good work...
     
    Last edited: Oct 16, 2018
  39. PiterQ70

    PiterQ70

    Joined:
    Mar 3, 2015
    Posts:
    59
    @Tryz Hi :)
    I considering use your MC in my project anyway I have two questions:
    1. MC is compatible with U2018.3 ?
    2. In my project I would like the character to climb on walls, obstacles, low walls etc, it will not be a problem to implement this to MC?
    Regards Peter
     
  40. Tryz

    Tryz

    Joined:
    Apr 22, 2013
    Posts:
    3,229
    Unfortunately, I can't commit to keeping up with all the changes every other asset developer makes. That's why I put this warning on the top of the page:

    These packages are FREE. Unfortunately, I can't always keep them up-to-date with the latest version of Unity, the Motion Controller, or the assets they connect with. There just aren't enough hours in the day.

    The older the date, the more errors you may find. You'll need to resolve any errors in order for the packages to work


    Make sure your NPCs have the motion you want to activate. For example, if you cast my Sleep spell, it activates the "Sleep" motion. So, you need to make sure your NPCs have the Sleep motion setup in their MC list.

    I can't guarantee the RE4 integration will work today... or tomorrow after Krypto changes his asset. I can guarantee the spells that are part of the Spell Casting Motion Pack work (if your NPCs have the motions listed that are being activated).

    With the big ADF update out, I plan on going through the integrations. I just can't guarantee when I'll get to each one.
     
    Weblox likes this.
  41. Tryz

    Tryz

    Joined:
    Apr 22, 2013
    Posts:
    3,229
    Hi Peter,

    1. I use it with Unity 2018.2.6f1. I wouldn't expect there to be any issues with Unity 2018.3, but it isn't officially released yet.

    2. The MC can climb walls, ladders, and obstacles. However, I use an edge-based approach vs. something like Breath of the Wild where you can climb anything in any direction.

    Check out the web demo and you can see how the climbing works.
     
  42. PiterQ70

    PiterQ70

    Joined:
    Mar 3, 2015
    Posts:
    59
  43. PiterQ70

    PiterQ70

    Joined:
    Mar 3, 2015
    Posts:
    59
    Ok I think this is what I lookig for :) If I have any problem I'll write.
    BTW. Did you have discord channel ?
     
  44. paifu

    paifu

    Joined:
    Jul 15, 2012
    Posts:
    20
    Hello, anyone have a blender file of a bow model with a working ootii armature? I tried to reproduce the bones like in the documentation without success at the moment. If i import the fbx model of the basic recurve bow, the bones don't appear positioned like in the documentation.
    I tried to replicate the armature like in the documentation for my model, but without success at the moment. Do I have to place the bones perpendicular of the model like in the first fbx?
     
    Last edited: Oct 18, 2018
  45. StayUpLate

    StayUpLate

    Joined:
    Jul 29, 2018
    Posts:
    58
    The bow fbx is in Assets\ootii\Assets\MotionControllerPacks\Archery\Content\Models\Weapons\Bows\RecurveBow_03. This fbx opens with good armature in Maya (LT). I cannot get it to open correctly in Blender, but I have this problem with lots of rigs in Blender so I'm thinking about switching to Maya LT personally.
     
    Tryz likes this.
  46. IsntCo

    IsntCo

    Joined:
    Apr 12, 2014
    Posts:
    141
    Do you happen to have a sample script for us less skilled coders to place on non-ActorCore gameobjects? Preferablly with a commented line saying where we can put whatever we want to happen when they are damaged? :)
     
  47. PiterQ70

    PiterQ70

    Joined:
    Mar 3, 2015
    Posts:
    59
    @Tryz Two questions:
    1. I see MC use Layers, it's possible to use tags ? It will be nice to reduce layers to one and use Tag. For eg. All Obstacles use one layer and to know what obstacle is add Tag "Low" "Middle" etc..
    2. Anyone use Finall IK with MC ??

    I was discovered weird behavior:
    https://drive.google.com/open?id=1YqEWRztmcyNmbPLg2yqGqmHxsx6IzFE-
    How can I fix this ??
     
    Last edited: Oct 18, 2018
  48. Salja

    Salja

    Joined:
    Mar 23, 2017
    Posts:
    326
    Yeah i use final IK with MC i Post few weeks ago a video from my stuff but i have reupload all on YouTube, the video just show my result i plan to make sometime Videos for setup
     
    Tryz likes this.
  49. rubble1

    rubble1

    Joined:
    Apr 25, 2010
    Posts:
    81
    Hey Tim, do you have a command reference or something on the ootii page?
    I wanted to know how to make the character point towards a target (actually on both axes), and also how to move towards it.
     
  50. Tryz

    Tryz

    Joined:
    Apr 22, 2013
    Posts:
    3,229
    How is this?

    Code (CSharp):
    1. using UnityEngine;
    2. using com.ootii.Actors.Combat;
    3. using com.ootii.Actors.LifeCores;
    4.  
    5. public class SimpleDamageHandler : MonoBehaviour, IDamageable
    6. {
    7.     public bool OnDamaged(DamageMessage rMessage)
    8.     {
    9.         Debug.Log("I took " + rMessage.Damage + " points of damage.");
    10.  
    11.         return true;
    12.     }
    13. }
    Just put this on your non-ActorCore character and when he takes damage, the OnDamaged() function will be called. I return 'true' to say that the damage was handled. It doesn't really matter if you handle it or not.
     
unityunity