Search Unity

  1. Calling all beginners! Join the FPS Beginners Mods Challenge until December 13.
    Dismiss Notice
  2. It's Cyber Week at the Asset Store!
    Dismiss Notice

Motion Controller

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

  1. StevanJay

    StevanJay

    Joined:
    Feb 5, 2014
    Posts:
    75
    Okay, I'm gonna give up and ask for help on this! I've been trying to increase the max angle for the target lock... It looked to me like the value comes from lMaxRadius in Combatant.FindTarget, but however high I pump this value up, it doesn't seem to make any difference. So I tried increasing various other values on FindTarget, but again with no luck, and don't immediately see anywhere else that could be controlling this effect... How should I be increasing that max angle for the target lock...??
     
  2. Tryz

    Tryz

    Joined:
    Apr 22, 2013
    Posts:
    3,225
    Hey @StevanJay ,

    It is lMaxRadius. You can enable debugging by uncommenting lines 539, 540, 555, 597, and 598.

    Here's what the default looks like (lMaxRadius = 8):


    Here's what it looks like with lMaxRadius = 28:


    Notice there's more spacing though. That means we're less likely to hit something. So, we probably want to decrease the DegreesPerStep (here it's now 10):



    I may need to come up with a different approach... maybe using some volume collider. But, for now you can change those values.
     
    StevanJay likes this.
  3. Necka_

    Necka_

    Joined:
    Jan 22, 2018
    Posts:
    396
    Hi,
    moving forward on Bolt and learning new stuff every hour; I can activate a motion easily from Bolt (screenshot)
    It works, but I'm just curious about the r Parameter. I used 0 and works so I didn't make any experiment.

    Is it the Motion Layer?
     

    Attached Files:

  4. StevanJay

    StevanJay

    Joined:
    Feb 5, 2014
    Posts:
    75
    Ah, I see, I was just missing with the gaps between the ray casts, I didn't notice how big those gaps would get... Yeah, that's gonna get pretty inefficient for the kind of size and resolution of arc I had in mind! But it looks like it should be pretty straightforward to use a flat arc instead, using the position of the Combat Transform as origin and just the y rotation from the camera, keeping x and z at 0. That seems like it'll get me a lot more coverage for the same number of casts, since I don't really care about anything that's much above or below my character... :)

    Thanks a lot for the help!
     
    Tryz likes this.
  5. recon0303

    recon0303

    Joined:
    Apr 20, 2014
    Posts:
    1,602

    Glad to hear ya that is why I mention the new Reactor system its alot easier. for none coders and even coders. to do less work now which is always a plus. glad you got it working.
     
    Tryz likes this.
  6. Tryz

    Tryz

    Joined:
    Apr 22, 2013
    Posts:
    3,225
    Some motions allow the rParameter to be set to change properties for the motion when it runs. For example, if you set rParameter when activating BasicMeleeAttack, it will define the attack style to use.

    Think of it like a generic parameter value. Most motions don't use it.
     
  7. pickle_rick1

    pickle_rick1

    Joined:
    Jan 7, 2018
    Posts:
    8
    @Tryz I'm using the archer motion pack with the camera controller top down view have problem when in the aiming animation its always aiming to the left not in the direction its facing I have look ik disable aim.png
     
  8. Tryz

    Tryz

    Joined:
    Apr 22, 2013
    Posts:
    3,225
    Hey @pickle_rick1 ,

    In your image the "Enable Look IK" option is checked in the Basic Ranged Attack motor. This is from your image...


    For a top-down view you'll want to uncheck that.

    You'll also want to make sure the "Empty" motion doesn't have that option checked. I don't think it exists for Archery, but check to make sure.

    If you need other help, feel free to email tim@ootii.com. Please include your Unity Order ID for the MC and AMP. Thanks!
     
  9. pickle_rick1

    pickle_rick1

    Joined:
    Jan 7, 2018
    Posts:
    8
    @Tryz thanks for the reply, look Ik is unchecked but this having the problem, when right click he is aiming at like 45 degrees left click does the same thing aim.png
     
    Last edited: Apr 9, 2018
  10. Tryz

    Tryz

    Joined:
    Apr 22, 2013
    Posts:
    3,225
    I'm guessing it has to do with Unity's mecanim layer blending.

    Can you email tim@ootii.com your character along with your Unity Order ID for the MC and AMP?

    Thanks
     
  11. pickle_rick1

    pickle_rick1

    Joined:
    Jan 7, 2018
    Posts:
    8
    just sent with the prefab n order id but cant find the order id for mc I purchased in 2015
     
    Tryz likes this.
  12. hopeful

    hopeful

    Joined:
    Nov 20, 2013
    Posts:
    4,958
    Just so you know, invoice numbers for older purchases can still be found if you use the old store. Order numbers for purchases using the new store may be accessed only through the new store.

    (Or at least it was that way when I last looked.)
     
    Tryz likes this.
  13. recon0303

    recon0303

    Joined:
    Apr 20, 2014
    Posts:
    1,602
    check Old store.. in the asset store, and check what you bought it will be there.
     
    Tryz likes this.
  14. Ryuichi173

    Ryuichi173

    Joined:
    Apr 12, 2015
    Posts:
    141
    Hello, @Tryz

    I already bought a motion controller license before, and now I'm considering to buy Sword and Shield motion pack to learn how to use this asset with specific situation, especially at close combat.

    By the way, have you ever try to do sync PvP animations and force root positions and rotations until animations finish?
    It is easy to interact with objects like treasure box because it not needed syncing animation but only you need is activate an event trigger to tell when to start animations.

    I'm in for trouble when I try to make fighting style mini-games, I think it needed specific behaviors compare to interact with static objects.
    Do you have any tips for do that?
     
    Last edited: Apr 10, 2018
  15. Dymental

    Dymental

    Joined:
    Sep 14, 2014
    Posts:
    29
    http://www.ootii.com/Unity/MotionController/MC2Guide.pdf - Page 32

    Wouldn't it be more suitable to use L0MotionParameter to randomize idles?
     
  16. Tryz

    Tryz

    Joined:
    Apr 22, 2013
    Posts:
    3,225
    Hey @Ryuichi173 ,

    If you mean wrestling style combat or grappling and throwing, I haven't done that... I just don't have the animations for it.

    With the MC, I believe it's doable. The trick would be custom motions that talk back and forth using messages. It's similar to what I do when an attacker swings a sword, the defender blocks, and the attacker reacts to the block.

    Timing of the animations would be critical, but you can control all that in Mecanim and trigger them through the motions.
     
  17. Tryz

    Tryz

    Joined:
    Apr 22, 2013
    Posts:
    3,225
    You can do it either way as all you're really doing is triggering Mecanim transitions.

    I figured showing L0MotionPhase would be more understandable to the reader since I talk about it more.

    Totally up to you. :)
     
  18. Ryuichi173

    Ryuichi173

    Joined:
    Apr 12, 2015
    Posts:
    141
    Hello, @Tryz

    Yes, that is! What I want to talking about is wrestling style combat in other words.

    Is it forces to controlling rotation and position too?
    I think, when try making grabbing attack, it is also critical problem that defender position and rotation must be overwritten or transition quickly. Otherwise it would be looks like attacked by Jedi's "Force power".
    But it might to be cause of problem about collider like written in manual's "Jump" animation 's section.
    And if I using Ragdoll or rigid-body or gravity option, I may should be turn off them while status is grabbed.

    Is there any samples to control position and rotation, or switching options I mentioned above?
    If you have better idea than mine, it is pleasure to telling me that.
     
    Last edited: Apr 10, 2018
  19. Tryz

    Tryz

    Joined:
    Apr 22, 2013
    Posts:
    3,225
    You can control position and rotation in the custom motions, but I believe games typically handle this kind of combat with animations.

    On the motion side, check out the Motion Builder's Guide and some of my videos.

    On the animations, I had read an article a while back (I believe it was the Arkham series) that talked about the coordination that close quarters combat uses between two combatants. They actually animate the characters together. This way characters fit together perfectly and land in the right spots. It's all about lining the characters up and then letting the animations handle the position and rotation changes.

    You can do it in the motions, but it will never be as smooth as with animations.
     
    Ryuichi173 likes this.
  20. recon0303

    recon0303

    Joined:
    Apr 20, 2014
    Posts:
    1,602

    'yup, and I do this a fair amount with games in Unity, Unreal Cry and other engines, most is done through animations, timing, etc.
     
    Ryuichi173 and Tryz like this.
  21. Ryuichi173

    Ryuichi173

    Joined:
    Apr 12, 2015
    Posts:
    141
    Hello, guys.
    Thank you for quick replying, and telling me experiences.
    And also I have to say sorry about my poor English.

    Yes it is! You are talking about what I wanted to say. Tell the truth, I have no idea how lining the characters in runtime.
    I cannot find manual or tutorials about lining the characters.
    Can I control them by using MC, or I should dig into Mecanim section?
     
    Last edited: Apr 11, 2018
  22. Xialya

    Xialya

    Joined:
    Oct 4, 2015
    Posts:
    48
    Hey there. :)
    I thought I'd ask here instead of bothering Tim with e-mails. :p

    Some questions that I've been around for a while:

    - Is it possible to have a NPC equipped with a bow or spell aim at a specific transform the same way the player lines up with the camera with the built-in motion IK, instead of relying on angles?

    ****

    - I plan on purchasing the Shooter motion-pack, but to use it for a crossbow as well, being closer to a rifle than a bow.
    In the documentation, I've read that it uses raycast to hit targets.
    Is spawning a projectile, like a crossbow bolt with an Arrow Core, doable?
     
  23. Tryz

    Tryz

    Joined:
    Apr 22, 2013
    Posts:
    3,225
    I just mean that in order for the synchronized characters to animate together, they both probably need to start in specific spots that the animations can then start from.

    Check out the Motion Builder's Guide and some of my videos that I sent earlier.

    Since you're building new motions, take a look at my "BasicInteraction.cs" motion. It shows one way that I line-up characters. Another option is just to use movement and rotation settings like I mention in the docs.
     
    Last edited: Apr 11, 2018
    Ryuichi173 likes this.
  24. Tryz

    Tryz

    Joined:
    Apr 22, 2013
    Posts:
    3,225
    It's no bother. :)

    Not out-of-the-box. I like the idea of using a target transform, but right now you'd have to modify the code.

    You could test this by modifying the BasicRangedAttack.cs file (lines 745 & 951). Notice how the UpdateLookIK() function is using the camera transform? Change that to use a different rotation (like the character's):

    UpdateLookIK(mMotionController.Transform.rotation);

    You could with a customized GunCore. The GunCore has a Fire() function that shoots each bullet (raycast). You could inherit from my GunCore and override that function to send out an arrow. I don't think it would be hard at all.

    I'm not sure if the Archery pack or Shooter pack is closer to a crossbow. The crossbow has a "load" like a bow, but doesn't need to "draw and hold". That's an interesting toss-up.
     
    hopeful likes this.
  25. Ryuichi173

    Ryuichi173

    Joined:
    Apr 12, 2015
    Posts:
    141
    Thank you for replying!

    Along to these suggestions you gave me,

    1.Most tricky part is that talk back and forth using messages. The good example included in "Sword and Shield motion pack".

    2. About lining up characters by MC, it would can be as same way as interacting with static objects like walls. I perhaps can manage them following guide and videos's interactions part.

    My main concern was you just mentioned above. "How can I manage and sharing info about specific spots (or transform) for lining up between combatants?" Because combatants are moving so they must be calculated in runtime I think.
    Do you have any good idea about managing a specific point for controlling motion while in wrestling style combat?
     
    Last edited: Apr 11, 2018
    Tryz likes this.
  26. Xialya

    Xialya

    Joined:
    Oct 4, 2015
    Posts:
    48
    Thank you Tim! :)

    I already had a look in UpdateLookIK() a while ago, but I failed to manage it at the time.
    I guess I was not calculating the Quaternion between the shooter and the target transform very well.

    This time I got it right, and I also used that Quaternion to release the arrow in the direction of the target transform.

    ****

    For the XBow, would it work to limit the magazine size to 1, as to reload a bolt everytime with a proper animation?
     
    Tryz likes this.
  27. Tryz

    Tryz

    Joined:
    Apr 22, 2013
    Posts:
    3,225
    In the Motion Builder's Guide I talk about creating new motions. This is what you'll need to do for tightly coupled wrestling animations.

    In the document, I talk about moving and rotating the character in the motion. Page 17 shows you an example of code to move the character when the Update() function of the motion runs.

    Code (CSharp):
    1. public override void Update(float rDeltaTime, int rUpdateIndex)
    2. {
    3. mMovement = mMotionController._Transform.rotation * (Vector3.forward * rDeltaTime);
    4. }
    You could use this approach to move the character to the specific point before starting the animations. How you determine and manage the specific point is really up to you.
     
    Ryuichi173 likes this.
  28. Tryz

    Tryz

    Joined:
    Apr 22, 2013
    Posts:
    3,225
    Yeah... that would work.

    Make sure to disable auto-fire too. :)
     
    hopeful likes this.
  29. Ryuichi173

    Ryuichi173

    Joined:
    Apr 12, 2015
    Posts:
    141
    Thank you for detailed answer, Tim!

    Yes, you are right. It should be done for own my hands because it would be core about game system.
    I've asked you because I thought if you have experience to try similar approach before, like "counter attack".
    I have some ideas for managing transform between combatants, so I'll test them first.

    Anyway, thank you for take your time.:)
     
  30. Tryz

    Tryz

    Joined:
    Apr 22, 2013
    Posts:
    3,225
    One thing I just remembered too...

    I added a function to the MC called "MoveAndRotateTo()". It's a coroutine you can use to move and rotation the character to a specific position over time. You may find that helpful. too. :)
     
    Ryuichi173 likes this.
  31. Ryuichi173

    Ryuichi173

    Joined:
    Apr 12, 2015
    Posts:
    141
    Thank you Tim, that tips is what I just searching for!;)

    Now I know what MC can do and what should programming myself.
    Again, thank you for helping me, Tim.:)
     
    Tryz likes this.
  32. StevanJay

    StevanJay

    Joined:
    Feb 5, 2014
    Posts:
    75
    Another question just out of curiousity... Why claim the Physics namespace for the Force script? Wouldn't it be possible to call it something else to avoid conflict, so that Unity's own Physics could then be accessed without having to specify UnityEngine.Physics each time...?

    (For reference, I'm experimenting with FindTarget in Combatant, using Physics.OverlapSphere, Physics.SphereCast etc. Took a while to figure out why it wasn't compiling when I didn't specify UnityEngine.Physics...).
     
  33. Tryz

    Tryz

    Joined:
    Apr 22, 2013
    Posts:
    3,225
    I couldn't come up with a better name and I figured the namespace would help. :)
     
    StevanJay likes this.
  34. TeagansDad

    TeagansDad

    Joined:
    Nov 17, 2012
    Posts:
    802
    Coming up with good names is often much, much more difficult than writing the code. :)
     
    JUBA-C4 and Tryz like this.
  35. JUBA-C4

    JUBA-C4

    Joined:
    Aug 16, 2014
    Posts:
    12
    hi
    when you fight with the sword you can't rotate the character easily like the bow

    like if i fight two AI one in the left and one in the right i had to stop for a while before i hit the other direction
    is there a way i can make it better out of the box before i mess things up before :(

    thank you :)

    one more thing @TeagansDad thank you so so so much <3 i owe him a big one
     
  36. Tryz

    Tryz

    Joined:
    Apr 22, 2013
    Posts:
    3,225
    This may have to do with your particular setup.

    Go ahead and email me as much info about your setup as you can. Screen shots of your motion setups and camera setups will help me duplicate what you have. Go ahead and email that to tim@ootii.com

    Please include your Unity Order ID for the MC as well.
     
    JUBA-C4 likes this.
  37. Harekelas

    Harekelas

    Joined:
    Feb 3, 2015
    Posts:
    743
    Hi Tim,
    Here is a question I need to ask:
    I met this super jump issue as shown:

    I set force grounding within 0.5m
    and step height 0.1, step down speed 0.1, step up speed 0.1 in actor controller.
    I also notice the character always bump to grounding colliders when the edge is 90 dgree (as a box collider)
    Any suggestions to make a smooth grounding and avoid this super jump?
     
  38. Tryz

    Tryz

    Joined:
    Apr 22, 2013
    Posts:
    3,225
    Hey @Harekelas ,

    The jump is a physics based jump. That means I'm taking gravity, mass, and the force of the jump into account. You can create super jumps or small jumps by modifying those values. That's something to check.

    You'll find "Mass" and "Gravity" on the Actor Controller.
    You'll find "Impulse" on the Jump motion.

    I did have a bug a while back where momentum was added too much into the jump. That should have been fixed a while back, but I'll do some more tests.

    What version of the MC are you using?

    If you can send me a small project where this is happening and your Unity Order ID, that would help.

    I talk about this in the Actor Controller Guide (page 18).

    The character will collide with anything above the step height. If you have a collider that is 0.11 units tall and 90 degrees than it's treated like a wall and will stop the character.

    Typically I keep the step height at 0.3 units.
     
  39. Harekelas

    Harekelas

    Joined:
    Feb 3, 2015
    Posts:
    743
    Thanks for reply!
    Problem is the collider is lower than 0.1, and the character can not walk on it in a smooth way, he's like suddenly bumped up from terrain to this collider.
    And check out the super jump issue in my video attached. It only happens when I hit jump button at the same time the character is changing his grounding collider from terrain to a box collider, I guess it's because he gets a pretty large upward force when he walks on a 90 degrees step, and the jumping motion took this force into account that made this character jump super high.
    BTW, my jump motion is a modified version from your basic jump motion, it's a bit different from the original jump.
     
  40. Tryz

    Tryz

    Joined:
    Apr 22, 2013
    Posts:
    3,225
    I think the best thing to do is send me a small project with that scene. I can't duplicate the issue here. So it could be something in the scene.

    Please include your Unity Order ID with the scene. Send them to tim@ootii.com.
     
  41. Tryz

    Tryz

    Joined:
    Apr 22, 2013
    Posts:
    3,225
    You may not have the momentum fix in your custom jump.
     
  42. Necka_

    Necka_

    Joined:
    Jan 22, 2018
    Posts:
    396
    Hello there,

    I'd like to ask if anyone has made or would know how to make a dual wielding system works with MC

    I fear that it's not going to be easy at all and would love some practical example on how I should approach this. I saw that Tim, you had that in your roadmap but of course I guess that's not possible with all your own work at the moment, maybe a video tutorial (if of course it's actually possible with the current MC)

    The fun part... I got Pirates in my game. and a Pirate (like in Assasin's creed for example) could do a slash with his Sabre and then shoot with his gun. Yeah fun stuff, but I can't wrap my head on how I would be able to do that with MC

    I got MC and all motion packs, so at least I got the core -_-

    thanks a lot
     
  43. Tryz

    Tryz

    Joined:
    Apr 22, 2013
    Posts:
    3,225
    Dual wielding with two swords shouldn't be any different than this video where I talk about custom melee animations:


    If you think about it, dual wielding is just an animation with attack points. The Sword & Shield Motion Pack handles that. You just need to add your custom animation.

    In the Sword & Shield Motion Pack and Shooter Motion Pack, I put the character into "stances". The reason is that walking with a sword in-hand is typically different than walking with a rifle in-hand. They both use Basic Idle, Basic Walk Run Pivot, etc. So, that's easy... you're just using a different "form".

    The real difference is that Basic Melee Attack expects the character to be in the melee combat stance (1) and the Basic Shooter Attack expects the character to be in the shooting combat stance (15). These are set when the Weapon Set is equipped (see the "Stance" property on the individual weapon sets).

    If you were to inherit from BasicShooterAttack.cs and override TestActivate(), you could allow the shooting motion to take place while in the melee combat stance (or visa-versa).

    Another option is to create a separate stance value to cover both.

    I haven't done this, but I really think it's just a matter of gluing the pieces that I have together. That starts with your custom animations.

    Feel free to email tim@ootii.com and I'm happy to keep helping. :)
     
  44. Necka_

    Necka_

    Joined:
    Jan 22, 2018
    Posts:
    396
    Well, I'm already fine with creating custom weapons, animations and attack style that I can change however I want with the reactors because those doesn't need much code (or I can manage with Bolt like what to do after receiving a reactor's message)

    But the stance part is scary now :(

    Basically I know that I'll only ever need to have a melee weapon (can be an Axe a Sword or else) paired with a Gun; I won't have a bow and a gun or a sword and a riffle clearly.

    Either option of overriding the activate test or creating a new stance are fine to me but I honestly don't know where to start or how to do that with my coding skills (the non-existent ones)

    Should I contact you via mail about it? I thought maybe someone would already have deal with that ^^
     
  45. Tryz

    Tryz

    Joined:
    Apr 22, 2013
    Posts:
    3,225
    Stances are just integers. Think of them like flags that tell us the mode or mindset the character is in...
    If the stance = 0... we know the character doesn't have any weapons equipped and is in a 'normal movement' mode.
    If the stance = 1... we know the character is in a melee combat kind of mindset.

    It's an easy integer to check with AI or things like the motions.

    We then use the "form" integer as a sort of sub-stance.

    Think of it like this...
    stance = 1 = melee combat mode
    form = 100 = sword and shield form of the melee combat mode

    They are just numbers to help us say what the character is doing. :)

    Yes. Feel free to email me and I can help guide you.

    You're mixing things (which is fine)... it just means there's some customization involved. :D
     
  46. Necka_

    Necka_

    Joined:
    Jan 22, 2018
    Posts:
    396
    Ok, that makes more sense now, I will prepare a maximum of things on my side to have everything ready (especially the extra required animations and so on) and contact you when the customisation part is required then, thanks a lot!
     
  47. Tryz

    Tryz

    Joined:
    Apr 22, 2013
    Posts:
    3,225
    hahaha... wait... just to be super clear...

    Unfortunately, I don't have time to do custom work for everyone. ;)

    Feel free to email if you have questions or get stuck. I'm always happy to help with advice. :D
     
    mandisaw likes this.
  48. Necka_

    Necka_

    Joined:
    Jan 22, 2018
    Posts:
    396
    I know, I was more speaking about guiding here, of course if it requires a full script I'll just give up or find a way to "cheat" with Bolt because I won't fool myself into becoming a coder from one day to another :p
     
    Tryz likes this.
  49. LukeDawn

    LukeDawn

    Joined:
    Nov 10, 2016
    Posts:
    342
    What's the best method for making tiny adjustments to the transform position when using MC?

    I'm running with networking, so as well as letting MC do it's thing client-side, I'm also sending my own IInputSource parameters to the server. This obviously leads to the need for interpolation, so I'm looking for the best method to make these little adjustments to the client's MC position.

    Many thanks, MC is a great tool.
     
  50. Tryz

    Tryz

    Joined:
    Apr 22, 2013
    Posts:
    3,225
    Grab the AC and use SetPosition() and SetRotation(). This gives you direct control over the transform.

    Code (CSharp):
    1. ActorController lAC = gameObject.GetComponent<ActorController>();
    2. lAC.SetPosition(<vector3>);
    3. lAC.SetRotation(<quaternion>);
    The MC also has a MoveAndRotateTo() coroutine that will move the character to the specific position and rotation over time. Under the hood, it uses AC.SetPosition() and AC.SetRotation() too.

    Thanks. :)
     
    Ryuichi173, hopeful and LukeDawn like this.