Search Unity

  1. Unity 2019.1 is now released.
    Dismiss Notice

Motion Controller

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

  1. Bernhardson

    Bernhardson

    Joined:
    Sep 24, 2018
    Posts:
    2
    Hi all,

    quick question: In order to understand how the motion controller works, I decided to go through the "Build your first motion" section of the Motion Buider's Guide.

    I am stuck at this point:

    "Then change the ‘Avatar Definition’ to ‘Copy From Other Avatar’ and in the ‘Source’ field, choose ‘DefaultAvatarAvatar’. Then, hit Apply."

    But there is no 'DefaultAvatarAvatar" in the list.

    I am in the terrain demo scene that I set up according to the latest ootii youtube video.

    Can somebody help me with this? Thanks in advance. : )

    Greetings
    Stephan
     
  2. Pheck

    Pheck

    Joined:
    Jul 9, 2009
    Posts:
    178


    I tried that code, and it didnt work (for my first post), hence the question in case i was missing something. ;)
    It doesnt report any errors, warnings, or show any odd behavior to indicate its doing anything. (this is with a stock sample setup)
    I also have an outstanding email with the creator, but no reply yet. he seems to be busy right now so i thought i would try the forum.

    I ended up getting it to "work" but it doesnt seem very hygenic of a way to do it, so i suspect its the wrong way.
    I had to add the five lines of code before "activatemotion" to get anything to happen. It requires knowing what the current motion or "prevmotion" is to feed to the "activate" function... which isnt always a reasonable assumption of knowledge...

    mMotionController.DisableMotion<BasicWalkRunPivot> (0);
    focusMotion.Activate(pivotMotion);
    focusMotion.IsEnabled = true;
    pivotMotion.Deactivate();
    pivotMotion.IsEnabled = false;

    mMotionController.ActivateMotion(focusMotion);
     
  3. TeagansDad

    TeagansDad

    Joined:
    Nov 17, 2012
    Posts:
    747
    @Bernhardson - just select the Avatar definition that is used by the default Idle animation. If you locate the animation file in the project view and expand it, you should see an Avatar definition underneath.

    I'm not at a computer right now, so unfortunately I can't give you the exact names or take a screenshot.
     
  4. TeagansDad

    TeagansDad

    Joined:
    Nov 17, 2012
    Posts:
    747
    You would be correct. ;)

    When you want to activate a motion via script, do it through MotionController.ActivateMotion(). The Activate() method on the motion itself (which needs a reference to the current motion) is called by MotionControllerLayer when it is time to activate the motion.

    If you peek at the source code for MotionController.ActivateMotion(), you'll see that it queues the motion that you wish to activate on its respective motion layer. You generally don't want to interfere with this, as you'll want the current motion to deactivate properly.

    The code snippet that @KeithBrown posted is the correct way to do it: use GetMotion() to get the motion on the specified layer, and then use ActivateMotion() to activate it. If it's not activating, then perhaps it's not finding the motion that you're looking for.

    Do you have any custom motions on the character, or is it just the stock motions?
     
  5. TeagansDad

    TeagansDad

    Joined:
    Nov 17, 2012
    Posts:
    747
    The assets are compatible with Playmaker. If your FSM isn't reporting a collision with the player, then you might be missing a kinematic Rigidboy on the player character. Ensure that Is Kinematic is checked, or else the Rigidbody will be fighting with the ActorController to control movement:

    upload_2018-11-14_11-9-3.png

    If that isn't the culprit, then check a few settings on your ActorController:

    The "Body Capsule" Body Shape should have "Use Unity Colliders" checked:

    upload_2018-11-14_10-58-5.png

    Ensure that the layer on which the FSM trigger is placed has been added to the Collision Layers mask:

    upload_2018-11-14_10-59-16.png

    The simplest way to make it follow the character is probably to create a NavMesh and add a NavMeshAgent to the enemy drone/character.

    To restart the scene, use:

    Code (CSharp):
    1. SceneManager.LoadScene( SceneManager.GetActiveScene().buildIndex );
    If you want it to be damaged by the player, give it an ActorCore (with BasicDamaged and BasicDeath reactors) and a BasicAttributes with a "Health" float attribute.

    The demo scene included with the Sword & Shield Motion Pack is a good reference for this.

    Yes; when a collision with the player is detected, you can send a DamageMessage to the player. ActorCore implements the IDamageable interface, so you just need to do a GetComponent<IDamageable> on the player's game object and call its OnDamaged() method, passing it the DamageMessage.

    A simple example would be (assume that the variable "player" is a GameObject):

    Code (CSharp):
    1. var damageMessage = DamageMessage.Allocate();
    2.             damageMessage.Damage = 50;
    3.  
    4.             var actorCore = player.GetComponent<IDamageable>();
    5.             actorCore.OnDamaged(damageMessage);
    6.  
    7.             damageMessage.Release();
    If a collider and a rigidbody are present on the sword, then it will use colliders for hit detection. Otherwise, it defaults to using a "Field of Attack" for hit detection. The docs for the Sword & Shield Motion Pack go into more details regarding this.

    There are multiple sword prefabs present, for different configurations:

    upload_2018-11-14_11-21-5.png
     
    Arcanebits likes this.
  6. TeagansDad

    TeagansDad

    Joined:
    Nov 17, 2012
    Posts:
    747
    @Bernhardson - Here's what I meant:

    upload_2018-11-14_11-24-18.png

    (Apparently you can't paste an image into an edit)
     
    Arcanebits likes this.
  7. Bernhardson

    Bernhardson

    Joined:
    Sep 24, 2018
    Posts:
    2
    Hey, thank you very much for your help and even adding a screenshot. I really appreciate it! : )

    I didn't think of it myself because all the animations have "create from this model" on them, so I didn't investigate further. Now I know where I can find the avatar-related stuff and that's great.

    Problem is, I should have mentioned that I did try using other Avatars, but they all give an error message: "Avatar creation failed: Transform 'Spine1' for human bone 'Chest' not found."

    I know that this might be standard Unity stuff and might not really belong here. I really don't want to ask questions that are already in the documentation and I don't want to ask stuff that I should already know, but I am really having a hard time bringing it all together. So following the documenentation closely is all I can do right now.

    Thanks again!
     
  8. TeagansDad

    TeagansDad

    Joined:
    Nov 17, 2012
    Posts:
    747
    @Bernhardson - the Avatar for the animation clip needs to match the rig used to create the animation. If you have a bunch of animations from the same source, you can streamline things a bit by having them all reference the same Avatar. And that way if you modify the Avatar, you only need to do it on the one that everything else references.

    For example, if you export clips from Mixamo, you can have them all reference a single Avatar, provided that they were all exported using the same model. So if you export one set of animations using xbot and another using the ybot, you will run into problems.
     
    mandisaw and Tryz like this.
  9. Arcanebits

    Arcanebits

    Joined:
    Dec 18, 2013
    Posts:
    64
    Sir, Your Answer and your avatar deserve a medal! THANKS A LOT!
    a3
     
    Tryz, hopeful and TeagansDad like this.
  10. inthemilkywat

    inthemilkywat

    Joined:
    Dec 29, 2013
    Posts:
    49
    I'm having problems with death animation not playing when AI is running. I'm using the basicWalkRunStrafe script on my AI and whenever I kill him, he just freezes in the run animation. Only happens sometimes when he running.
     
    Last edited: Nov 16, 2018
  11. abitofjohn

    abitofjohn

    Joined:
    Nov 6, 2012
    Posts:
    22
    Hi, I'm considering purchasing this asset. I am just wondering how well it plays with cinimachine? I have been using cinimachine to drive a 3rd person camera in my current project. Would that be possible with this asset or is the camera control integral?

    Thanks
     
  12. Tryz

    Tryz

    Joined:
    Apr 22, 2013
    Posts:
    3,171
    I'm not sure how you're killing him. If you look at my BasicKilledReactor.cs there's a function called InternalDeath(). This is where I play the death animation, wait for it to end, and shut the components down. This way they don't react to things in the future.

    With the freeze happening only sometimes when he's running, I'm wondering if your death motion has a high enough priority. Make sure in the motion list that it has a higher number than anything else.

    I'm not reproducing it here. So, you would have to email images of your motion setups and maybe a video to tim@ootii.com and I'll look when I can.
     
  13. Tryz

    Tryz

    Joined:
    Apr 22, 2013
    Posts:
    3,171
    Unfortunately, I haven't used Cinimachine. I believe others have said they did, but I'm not sure what was required.

    You don't have to use my camera, but there are some motions (like the walk/run pivot) motions that do use a camera to determine pivots and such. There are other motions you can use instead (ie walk/run strafe), but it really depends on your goal.
     
  14. Pheck

    Pheck

    Joined:
    Jul 9, 2009
    Posts:
    178
    //=======================

    Everything is stock from the example character in the demo scenes. using just motioncontroller.activatemotion() produces no results and no log feedback for why. Its the correct motion and its finding it in the list because when i add the other "dirty" lines of code, it seems to work. I also added some debug.log to make sure it was hitting code points and taking the functional call in.

    quite frankly, i have wasted about 9 days trying to get this tool to do anything beyond whats directly built in... its been a frustrating waste of time. It seems to do whats built in just fine, but going beyond that is a large trial of patience. I see where the way i got it to work is dirty (and esoteric), but it doesnt seem anyone has any suggestions beyond what "should" be the correct way... which doesnt work in the most basic test. The documentation either provides no answers, or the answer is buried somewhere deep in a random place. I still dont even understand what the numbers are for to the right of the motion list... its not listed anywhere I can find in the documentation, they dont have a title, and I dont see a popup on roll over. is it priority? stance? speed? lotto numbers? Some motions have activation keywords, some dont... why? why not standardize across all of them?
    sorry for the rant. I feel the price for the tool and the difficulty its provided has not been an equitable trade so far, but i guess thats a problem for a different time.

    thanks for trying to help
     
  15. Tryz

    Tryz

    Joined:
    Apr 22, 2013
    Posts:
    3,171
    I'm sorry it's taking so long for you to customize what you want.

    Unfortunately, I have to take these kinds of rants with a grain of salt. There are literally 1,000's of people using these assets for all types of games. While I'm confident the assets aren't perfect, this kind of post is something I get only once or twice a year... which makes me think the issue is more with the user.

    For example, "I still dont even understand what the numbers are for to the right of the motion list... its not listed anywhere I can find in the documentation". I answer that in the Motion Controller's Guide on page 13. There's even a nice big picture:



    Please remember that the 99.9% of us asset developers have daytime jobs. We are not doing this full-time with a staff of people helping and we can't possibly include every feature for every game that every person can think of. That means you will have work to do to create your custom game. If that scares you, purchasing assets from the asset store may not be for you.

    That ends my rant. :D

    [EDIT]
    I should add that I'm not trying to belittle your need for help; we all need it. It's the rant approach. ;)
     
    Last edited: Nov 17, 2018
    mandisaw likes this.
  16. StevanJay

    StevanJay

    Joined:
    Feb 5, 2014
    Posts:
    73
    Hey! I just upgraded Third Person Motion Controller, Camera Controller, and Sword and Shield Pack to the most recent versions, but it`s giving me a whole bunch of "namespace does not exist" errors, all coming from Assets/ootii/Editor... Any ideas what`s happening...??

    ootiiUpdate.jpg
     
  17. StevanJay

    StevanJay

    Joined:
    Feb 5, 2014
    Posts:
    73
    Ack, nevermind, I just found the update notes!

    Ouch... Got a lot of custom stuff in those folders, that I`m going to have to keep track of........
     
    Tryz likes this.
  18. Tryz

    Tryz

    Joined:
    Apr 22, 2013
    Posts:
    3,171
    Unfortunately for this update it does require a full import to a new folder structure. I've never had to require this before, but this time I did for Unity features.
     
  19. RonnyDance

    RonnyDance

    Joined:
    Aug 17, 2015
    Posts:
    557
    One question regarding Networking:
    I read the Answer Page regarding the network example. Does the controller support Multiplayer using Mirror (no Unet), so it's possible to use it with uMmorpg for example? Perhaps someone has any experience with it?
     
    Last edited: Nov 22, 2018
  20. PolyCurseGames

    PolyCurseGames

    Joined:
    Jan 25, 2018
    Posts:
    41
    What would be the best way to implement a click to move action? (I searched the forum and it was asked once or twice before, and at one point a simple tutorial was offered, but I couldn't actually find any follow up or the actual tutorial) Thanks!
     
  21. KeithBrown

    KeithBrown

    Joined:
    Apr 1, 2017
    Posts:
    85
    If you set your player up as an NPC, you can write a simple mouse click script that sends the cursor location to the NPC. Tim created a video series on youtube about npcs and showed how node canvas sends the information to the npc. Instead of node canvas you can use the mouse click position and send it instead.

    I don't have a working example (I am at the office an not at home in front of my Unity machine) but that is the general idea.
     
    Tryz likes this.
  22. Tryz

    Tryz

    Joined:
    Apr 22, 2013
    Posts:
    3,171
    The controller itself doesn't include any specific multiplayer code. You probably saw a small component I included to help with Unet, but other than that you'd need to manage multiplayer communications at a higher level.
     
  23. Tryz

    Tryz

    Joined:
    Apr 22, 2013
    Posts:
    3,171
    @KeithBrown is exactly right. You'd treat the character like an NPC and you can use one of the approaches from my video:



    For example, you might take the click point and use MotionController.SetTargetPosition(). However, if you're using Unity's Nav Mesh Agent, you may want to use my Nav Mesh Input Source and set the "Target" property. It really depends on how you're wanting to select the position in your game. This part is really regardless if you're using the MC or not.
     
  24. Hellwaiker

    Hellwaiker

    Joined:
    Jan 8, 2016
    Posts:
    62
    Hey,
    In ladder motion when character is standing at the top of the platform, and climbing down the ladder animation starts.
    The position, from where this whole "Climb down the ladder" motion starts is determined by where the character is when the motion is activated, or is it defined by one of the offsets?
    Closest thing I found is Top start edge forward, but this seems to trigger after the animation starts. So animation starts and character "flies" to the this point. But is there any offset for "Start motion animation from here"?
     
  25. StayUpLate

    StayUpLate

    Joined:
    Jul 29, 2018
    Posts:
    58
    Whats the easiest way to haul an entire MC config over te a new character? Just dragging and dropping all the scripts to my new character seems to create an afwful mess :p Is it possible to crate an empty object with all the MC stuff onto (so an empty obj as target) en just hang a replacable character prefab underneath that?
     
  26. FargleBargle

    FargleBargle

    Joined:
    Oct 15, 2011
    Posts:
    649
    You need all of the Ootii scripts plus the character controller, which contains all of the mecanim animations. In order for this to work without issues, the character rigs need to be pretty much identical, so if you swap between two Mixamo characters with the same bone structure for instance, everything should work, but if the skeletons don't match, you could have problems. I tried copying between UMA and Mixamo characters at one point, and while overall animations were fine, details like hand/finger placement were off, due to the different bone structures. You may need to reconcile them using the Mecanim humanoid rig setup tools in such cases. Also, if the characters are sized differently, you may need to adjust MC settings like hand grab offsets - used for climbing - to match the new size.

    Since MC is normally installed on the character root, which contains the animator, you can't just put everything on a separate game object. A certain amount of copying/pasting will be needed. That said, I've successfully copied rigs from Ootii demo scene characters to my own, whenever I wanted to quickly test out new features, and had no serious problems. Setup wasn't instantaneous, but it was reasonably quick.
     
    Last edited: Nov 29, 2018
    Tryz, StayUpLate and rubble1 like this.
  27. Tryz

    Tryz

    Joined:
    Apr 22, 2013
    Posts:
    3,171
    You were close.

    If you open the "Reach Offset" option, you'll see a "Top Start Actor Up" property. I believe it defaults to -0.8. Change that and the character will shift up and down when starting to climb down from the top.

    I think there's a limit. But, you'll just have to play with it.
     
  28. zefirozh

    zefirozh

    Joined:
    Jun 18, 2018
    Posts:
    15
    Hello, I need some help for decide which 3rd person controllers gonna work well with ORK Framework. I have like 3-4 choices right now and your product is on my top list. I need to make sure that your controller can intergrate with ORK Framework. And one more thing I would like to add more animation like gunfire do I have to purchase addon for that or I can add animation by myself in your Motion Controller which I want to make my RPG Game on ORK then I don't need any extra gunshooting controller templates just only animation to deal with my gameplay.

    Thankyou for your answer.
     
  29. MaximilianPs

    MaximilianPs

    Joined:
    Nov 7, 2011
    Posts:
    196
    Ok I definitely need help,
    I need to add another kind of fight, which is unarmed.
    It should be activated by pressing a key, something like 0 unarmed, 1 sword and shield, 2 bow...
    Any reference or tuts. about that? :rolleyes:
     
  30. TeagansDad

    TeagansDad

    Joined:
    Nov 17, 2012
    Posts:
    747
    @zefirozh - Motion Controller is IMO the best choice for integrating with a system like ORK Framework. And I have spent a significant amount of time trying to integrate ORK with Motion Controller as well as both of its primary competitors (I'm sure you know which ones those are).

    While I'm a big fan of ORK, I've never found its real-time combat framework to be up to the task of creating a responsive and dynamic combat system. To get those responsive-feeling controls, you ultimately need more direct control over the animator controller and ORK's animation system doesn't give that to you.

    So regardless of which third person controller one is using, I have found that the approach which produces the best results is to have ORK handling the RPG mechanics in the background and keep the character controller in charge of movement, animation, hit detect, etc. The point of integration will be different for each character controller, but in abstract terms, once it is determined that an attack has successfully hit an opponent, you want to get references to the ORK Combatant on both the player and the target and then use ORK's API to calculate the damage and any other effects (such as a status effect), bypassing the character controller's built-in health system.

    Motion Controller is easier to customize than it's competitors, as you will rarely (if ever) need to modify the asset's source code (I cannot say the same regarding either competing controller). The majority of components are designed with extensibility in mind, so most methods are already public virtual or protected virtual, and class fields also tend to be protected rather than private. And while the asset certainly makes use of inheritance, I would say that overall, the ootii suite of products follows the principle of "favor composition over inheritance." I'm thinking of one other controller in particular here that has parallel inheritance graphs for a player controller and an NPC controller, which I found endlessly frustrating to deal with.

    For Motion Controller, you can inherit from the Basic Damaged Reactor and instead of applying damage to the "Health" Basic Attribute, you call the ORK "Calculate" method. It's not quite as simple as this, as ORK needs the context of one of its Battle Events in order to actually perform the calculation, but you can build that up yourself via scripting.

    If you're looking to add gunplay, then definitely go with the Shooter Motion Pack. You'll no doubt want to customize and tweak the feel, but it's a solid base to build upon. And while ORK can handle spells via its Event system, I've again found more satisfying results with using ootii's Spellcasting Motion Pack to handle the animations, physics, hit detection, etc, and then using ORK to calculate the effects. Synchronizing effects or gameplay elements with animations in ORK alone is a major hassle, as its visual scripting system has no built-in way to handle animation events. It's not impossible to handle them, but in the end you're just creating a "wait" loop and checking a boolean value, which prevents you from any sort of parallel logic. The Spellcasting MP has no such limitations.
     
    mandisaw, Tryz and zefirozh like this.
  31. TeagansDad

    TeagansDad

    Joined:
    Nov 17, 2012
    Posts:
    747
    You would follow the same approach as with the Sword & Shield Motion Pack. Your weapon prefab would have a collider, rigid body, and Sword Core, but no visible mesh. And you would need to select a new Motion Form integer to represent the unarmed style (SSMP uses 100).

    I'll try and write up a more detailed reference when I get a chance, but I wanted to give you an answer of some sort now.
     
    Tryz likes this.
  32. zefirozh

    zefirozh

    Joined:
    Jun 18, 2018
    Posts:
    15
    Thanks a lot for you reply, I also try to learn how Motion Controller works by watching tutorials and Yes you are definitely right. The Asset is more flexible than anothers. I think I gonna go with this controller for sure ( actually already bought it an hour ago. ) By the way about intergration with ORK could you point me some tutorials to do what you explained on your reply.
     
    Tryz likes this.
  33. BroVodo

    BroVodo

    Joined:
    Oct 2, 2012
    Posts:
    6
    Has anyone had problems with integration with Apex Path/Steer where units with SteerForUnitAvoidanceComponent aren't avoiding each other?

    [edit]

    Steering Scanner was detecting the actor controller's added unity colliders, unchecking use unity colliders, then adding a collider manually fixed this.

    Anyone have an idea why colliders added at run-time cause problems in Apex? Probably an Apex thing, but asking here is infinitely more likely to get an answer, because y'know - [Deprecated]!

    [edit]
    Apex Path's UnitFacade.collider only returns one collider, regardless of how many are attached. This is where problems will arise if a unit has multiple colliders.
     
    Last edited: Dec 4, 2018
  34. nathanjams

    nathanjams

    Joined:
    Jul 27, 2016
    Posts:
    170
    Hello,

    Has anyone here been able to get the swimming pack working in a multiplayer game?

    We've managed to get pretty much everything working with Motion Controller, except swimming. When loaded in a networked game, when the player hits the surface they get stuck in a loop of switching between swimming and standing animations. However, if we load the exact same player (motion controller and actor controller (which had grounding set correctly), etc) in a single player game everything works.

    I know this is a really vague, and most likely a case specific question, but I'm hoping maybe someone has an idea of where we can look.

    Thanks in advance,
    Nathan
     
  35. ppbpmkuro

    ppbpmkuro

    Joined:
    Dec 5, 2018
    Posts:
    6
    I'd like to insert each other attack motions into the Z, X, C keys.

    z key : punch / x key : Jab / c key : Kick

    So, I tried to make it by adding several [punch] on the [Upper layer]
    but it doesn't work. All buttons is only play the Punch.

    1.png 2.png

    I couldn't find a any tutorial about this...I need Help.
     
  36. Subliminum

    Subliminum

    Joined:
    Nov 9, 2017
    Posts:
    70
    Ensure that each Custom Motion is triggering the right Phase value, it looks like you may be using the punch motion for each of your animator SM's. Punch has a PHASE_START value of 500, so if each of your motions is using that same unchanged code they will all be going into the Punch-SM instead of your desired SM. If that has been done correctly and each of your Custom Motions has the updated auto-generated scripts attached, check that you have correctly set up the input entrys.
    It also appears that you have just input your desired key into the Action Alias property. You would instead need to create a input for x with the Action Alias of 'Combat Jab' and have Combat Jab in the Action Alias property of the Motion where 'x' is currently.

    Creating custom motions can be a complex process and it is good to start with simple motions like these. Have you tried following the Ootii Motion Builders Guide? It covers a lot of the basics in depth and should easily empower you to create what you need.

    http://www.ootii.com/unity/motioncontroller/MCMotionBuilder.pdf

    Hope this is helpful! :)
     
  37. ppbpmkuro

    ppbpmkuro

    Joined:
    Dec 5, 2018
    Posts:
    6
    Thank you so much! I thought could easily add motion with drag & drop.
    But it was much more complicated and Not a easy to use, than I expected....oTL
    Of course, I know it have huge potential because it's for High Class developer. and I agree this is very good Asset!

    Unfortunately, I'm a beginner,I can't handle a Programing code. so ashamed.
    (I implement most of my games with FSM)

    Anyway, I'll try to Make a Custom motions with your advice.
    but the moment I saw the PDF file I can feel it!
    I probably won't make it. lol
     
  38. FargleBargle

    FargleBargle

    Joined:
    Oct 15, 2011
    Posts:
    649
    Don't give up. There's a learning curve for sure, but what you're trying to do is definitely achievable. If all you want to do is press a button to activate a simple one shot motion, like a punch or kick, there's no need for elaborate scripts - the simple motion template built into MC can do that for you in just a few simple steps. Just follow the example at the start of the guide @Subliminum provided, and make sure you assign a unique name, phase ID, and action alias for each motion. Then if you want to move your motions to the upper body layer, or build more complex behaviors, you can dive deeper into the Motion Builder Guide as you gain more experience and confidence.

    Simple motions were how I started with Motion Controller, and believe me, I was just as lost and confused as you on my first attempts. I've since moved on to more complex motions and behaviors, with scripts to activate and deactivate motions, or control my characters in other ways. Just keep reading and working through the examples - nothing beats the satisfaction of seeing your own animations finally bring your character and game to life. :)

    You can find more information about simple motions on page 25 of the main MC2 Guide, or in this video tutorial:
     
    Last edited: Dec 5, 2018
  39. LunarLabs

    LunarLabs

    Joined:
    Dec 21, 2016
    Posts:
    16
    Hey OP, great set of assets.

    Is there a way to use the more advanced motions with the sword and shield pack?

    To clarify - I have my motion controller set up in "Shooter" mode so the dude can strafe right and left instead of turning, when he pulls his sword out there just seems to be the jankey "basic" blend tree set of animations that effectively put him into an "adventure" mode type movement where he can walk to the camera etc.

    I've watched through the replacing animations tutorial, and it's very good - However my particular interest has been in the WalkRunPivot advanced animations and it looks like the S n' S pack doesn't come with any advanced blending animations at all and they'd need to be created manually. Is that correct?

    Kind Regards,
     
  40. LunarLabs

    LunarLabs

    Joined:
    Dec 21, 2016
    Posts:
    16

    You know, I hate to be that guy but it does seem like I didn't engage myself enough in the comprehensive video tutorials, so I apologise.

    For anyone who has the same question as I did, specifically in regards to dealing with the motion priority when setting up movement packs - see this video -


    Keep up the good work folks

    Edit: The SnS pack does have an advanced blend tree set of animations that come with it, it just defaults to the basic set. :)
     
    Tryz and hopeful like this.
  41. ppbpmkuro

    ppbpmkuro

    Joined:
    Dec 5, 2018
    Posts:
    6
    Hi
    Thank you. last night, I bought an additional Sword & Shield motion pack.
    I understood the process of making, put in or put out the weapons. and the 'stance' state. i'm so happy now.

    But I met another problem When I'm trying to add a 'new Input key'.
    First,I opened the Unity Input setup. OMG,There were a lot of new things that you couldn't see before you installed the Motion controller.I was a little nervous when I saw it.

    Anyway, Fire1 = mouse 0 and left ctrl
    I understand it. :)
    and action alias = Fire1
    I knew 'Fire1' was used action alias.

    But, the process of the Animator's L1 MotionPhase to Fire1's connection is I don't understand.
    I searched for manual for hours, but I couldn't find it. Instead, I found this. 'Easy Input Asset'

    Would it be easier for me to do what I want(add new key) if I buy 'ootii's Easy Input asset'?
     
  42. FargleBargle

    FargleBargle

    Joined:
    Oct 15, 2011
    Posts:
    649
    I use Easy Inputs because it lets me switch action aliases on the fly to do different things in different situations. It's a great way of managing the limited number of buttons that are available on a game controller or joystick for instance. I wouldn't say it's "easier" than using the built in Input Manager settings though. You still need to have a good understanding of how they work first.

    Motion Controller and its add-on packs, as well as most other game play related assets you install, will add entries to the Input Manager. If you look at the individual entries, many will be duplicates of existing physical actions, but have different names, or action aliases. So "Fire1" is an alias for the left mouse button, but so is "Combat Attack". Action aliases are a way to separate the activation commands in your scripts from the physical buttons and controls that will be used for them. This way, if you decide you want to use a different button for "Combat Attack", instead of rewriting all of your scripts, you can simply go to the Input Manager and assign a new button to it.

    The other thing action aliases do in the case of Ootii assets is to provide the link to the L0 or L1 Motion Phase each motion is looking for to activate. So you need to assign an action alias to a phase ID in the motion setup in order to trigger a specific motion with a specific command.

    Once you get your head around what the Input Manager does, and how it works, you can move on to tools like Easy Input, if they make sense for what you are doing, but without a basic understanding of Input Manager, Easy Input could just make things more confusing for you.
     
    Tryz and TeagansDad like this.
  43. ppbpmkuro

    ppbpmkuro

    Joined:
    Dec 5, 2018
    Posts:
    6
    I Can't add a new attack style. Help me!

    I was watching this video.

    But my character works differently than video.

    Why My Attack Style is empty...?????
    And when I put on the hand a weapon press 1 key

    '2 Attack styles pop up!

    And when I store my weapon, it disappears.
    If I add a new custom attack style into the 'Attack Style' like a youtube video, Game is down when I Store a weapon.

    2018 14-51-27.gif
     
    Last edited: Dec 6, 2018
  44. Subliminum

    Subliminum

    Joined:
    Nov 9, 2017
    Posts:
    70
    The Attack Profile on the prefab for the weapon you are equipping is responsible for this.This adds the Attack Styles dynamically so you can equip different weapons with different styles for each.

    https://ootiigames.com/?page_id=1292

    Here is a link to some information on how they function and creating them.

    All the best!
     
    Tryz likes this.
  45. ppbpmkuro

    ppbpmkuro

    Joined:
    Dec 5, 2018
    Posts:
    6
    Thank you. you are my hero!
    I don't Understand. Why old video still survival on Youtube tutorial channel? Hm...

    Anyway,I'm very happy now! I finally did it! But I think it's too simple to have a just only one attack button.
    I still need at least 3~5 attack buttons.

    So, my Next Big Try is about the 'how to add new key'
    Last night I searched hard for the 'answer'. but I still have no idea...

    If the developer could produce a tutorial video about it.
    it would be very helpful for beginner. just like me. oTL.
    Now I'm wait for his answer. I've done everything I can....
     
    Subliminum likes this.
  46. Subliminum

    Subliminum

    Joined:
    Nov 9, 2017
    Posts:
    70
    Nice work ppbpmkuro, So correct me if i'm wrong here but your goal is to trigger different Attack Styles for a equipped weapon based on the key input?
    If that's the case you can set the from of an attack style by code. Here is an example from the S&S Motion Pack Demo this exert is from the SS_NPC_Controller_v2.

    Code (CSharp):
    1. /// <summary>
    2.         /// Example code on how to force which attack style to use.
    3.         /// </summary>
    4.         /// <param name="rCombatant">Combatant the event was fired for</param>
    5.         /// <param name="rMotion">Motion that represents the attack</param>
    6.         /// <returns></returns>
    7.         private bool OnAttackActivated(Combatant rCombatant, MotionControllerMotion rMotion)
    8.         {
    9.             BasicMeleeAttack lAttacks = rMotion as BasicMeleeAttack;
    10.             if (lAttacks != null)
    11.             {
    12.                 lAttacks.CurrentAttackStyleForm = 100;
    13.             }
    14.  
    15.             return true;
    16.         }
    Unfortunately I don't have much experience in that area, and am not sure if that's the best way to be going about it. You would need to code the logic for switching CurrentAttackStyleForm based on Alias Inputs. Hopefully someone with more knowledge of the MC can chime in with a simpler solution.
     
    Tryz likes this.
  47. rubble1

    rubble1

    Joined:
    Apr 25, 2010
    Posts:
    75
    I've been playing airing around with the shooter pack. Loads of fun (pun intended). A couple questions.

    Can I get the gun to shoot an actual prefab rather than emit particles? Say I wanted to do a star wars blaster, or a rocket launcher, where the projectile needs to be an object.

    The other thing, I think relates to recoil, but I'm not sure. I've got a custom gun set up in the character's hands, but when he fires, he just leans back a little, pointing the gun up in the air, despite the gun being placed correctly when the character's walking. Is that the recoil? How do I fix this?

    What about if I wanted to add melee attacks to a gun. Say an enemy is up close and I wanted to hit him with the gun without firing. I shouldn't need to equip a weapon to switch to melee. I can just add a sword core or something, is that right? Or say the other way around, maybe like a zelda sword that fires? Same idea?

    Lastly I just wanted to say thanks. What a great system you've created that allows us to create. On this new version, although I haven't used it extensively, I think the character wizard is a cool idea, saving a lot of time in setting things up.
     
    TeagansDad likes this.
  48. ColBashar

    ColBashar

    Joined:
    Mar 17, 2017
    Posts:
    3
    Hi Tim.

    So I'm having a noob issue and I think either I'm missing a step or functionality isn't working as I expect it to. I'm setting up an NPC but for some reason they're not showing walking animations when I direct them to a location with the MoveToDriver. The model slides around in its idle pose, as if skating.

    I then tried removing the MoveToDriver and directing the character using the SetTargetPosition method in the MotionController. There was no movement whatsoever.

    I then tried directing the model via script and checking the Use Transform box in the Actor Controller. The model moved but still no animations.

    I've tried using the basic and V2 versions of the Idle and Walk Run Strafe motions through the wizard, the Basic setup, and manually setting them up in the inspector. I'm using the Humanoid animation controller in the MC folder. I watched your NPC 0 and 1 videos and it seems like this should just work out of the box.

    The MC is functional because when I use an input controller, the model will animate based on my key press, independent of the movement of the object. When I unlink the input controller, though, it just remains in idle pose. Any ideas of what I'm missing?
     
  49. TeagansDad

    TeagansDad

    Joined:
    Nov 17, 2012
    Posts:
    747
    There are unfortunately no such tutorials available. I have some partially-completed integration code that I have always intended to share, but I never seem to get it to the point where it's polished or complete enough that I feel comfortable making some sort of "official" release (as doing so will inevitably result in me needing to answer questions that could be avoided if I can just release the code in a more complete form).

    Most of this code that I've written was from before the major update of the ootii assets this summer, which reorganized the folder structure and reworked some of the serialization code in order to support assembly definition files. I started updating and refactoring my existing integration code (some of which was pretty old and I decided could be written better) a few months ago, but I've been pretty busy with work, kids, and other real-life stuff so I haven't touched it in a while. There have been some changes to ORK's API that will break my existing integration code as well.

    However, in the meantime I can give you a few code snippets that accomplish what you'll need to do.

    If you're building a custom Damaged Reactor, you'll need to create an AbilityAction (inherits from BaseAction) so that the ORK Ability can be used to calculate damage and effects:

    Code (CSharp):
    1.  
    2. private BaseAction GetAbilityAction(CombatMessage rMessage)
    3.         {
    4.             if (rMessage == null)
    5.             {
    6.                 return null;
    7.             }
    8.  
    9.             // Try and get the attacker object from the CombatMessage
    10.             GameObject lAttacker = rMessage.Attacker;
    11.             if (lAttacker == null)
    12.             {
    13.                 // if we can't, then we'll try and get it from the root GameObject via the weapon reference
    14.                 if (rMessage.Weapon != null)
    15.                 {
    16.                     lAttacker = rMessage.Weapon.gameObject.transform.root.gameObject;
    17.                 }
    18.             }
    19.  
    20.             // If we have the Attacker GameObject, we can get the Action through its Combatant component
    21.             if (lAttacker != null)
    22.             {  
    23.                 var combatant = ComponentHelper.GetCombatant(lAttacker);
    24.                 if (combatant != null)
    25.                 {
    26.                     AbilityShortcut lAttackAbility = combatant.Abilities.GetCurrentBaseAttack();
    27.                     return new AbilityAction(combatant, lAttackAbility);
    28.                 }              
    29.             }
    30.  
    31.             // We tried everything and could not get an Action
    32.             return null;
    33.         }
    34.  
    (You would want to cache the cache the current attack ability and AbilityAction to avoid creating a new object for every calculation, but you don't need to worry about that too much during the prototyping stage.)

    To handle the damage calculation on the target (once you have the attack AbilityAction):

    Code (CSharp):
    1. public void HandleDamage(ORKFramework.Combatant targetCombatant, BaseAction attackAction, float damageFactor = 1.0f)
    2.         {
    3.             if (attackAction == null) { return; }
    4.  
    5.             // Set the ability's target
    6.             attackAction.SetTarget(targetCombatant);
    7.  
    8.             // Calculate the effects; we want "animate" to be false because Motion Controller is handling
    9.             // the animations
    10.             attackAction.Calculate(new List<Combatant>(), damageFactor, false);
    11.         }
    Hopefully that should be enough to steer you in the right direction. I'll see if I can get back to updating the integration code to the point where at least it all compiles. :) But that might not be until after Christmas.
     
    Tryz and hopeful like this.
  50. Tryz

    Tryz

    Joined:
    Apr 22, 2013
    Posts:
    3,171
    Hey @ppbpmkuro , as a one-man-show with family and a job I do my best to keep documentation, videos, and features updated. Sometimes old videos survive because 90% of the video is still valid and it's one piece that needs updating. Thanks for understanding.

    @Subliminum has a great first step. He's exactly right. :)

    To take this one step further, you could have multiple keys activate the one motion. If you think about how Unity's Input Manager works, you just have multiple entries for "Combat Attack". That means multiple keys send the attack signal. Then, in the code @Subliminum shows, you can see which input key is down and trigger different styles.



    For more complex key & combat systems, you may want to control the attacks outside of my one-key "Attack Alias" that is on the Basic Melee Attack motion.

    What I mean by this is you can have simple custom code that sets which attack style to use and activates the Basic Attack Motion. For example, here's some simple code that activates the second attack style:
    Code (CSharp):
    1. BasicMeleeAttack lMotion = mMotionController.GetMotion<BasicMeleeAttack>();
    2. mMotionController.ActivateMotion(lMotion, 2);
    3.  
    With this kind of approach, you have to manage the input conditions yourself. However, you have total control.


    I agree that it might be interesting to have an "Attack Alias" per attack style, but that's not a feature that exists today.
     
    Last edited: Dec 9, 2018
    Subliminum likes this.