Search Unity

  1. New Unity Live Help updates. Check them out here!

    Dismiss Notice

Motion Controller

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

  1. PiterQ70

    PiterQ70

    Joined:
    Mar 3, 2015
    Posts:
    59
    I want to see this ;)
     
  2. Tryz

    Tryz

    Joined:
    Apr 22, 2013
    Posts:
    3,229
    Since Unity's PhysX engine uses layers, that's the much faster approach for filtering objects you can climb. While you could use a combination of layers and tags, that's not something I do natively. You could create a custom motion that does.
     
  3. Tryz

    Tryz

    Joined:
    Apr 22, 2013
    Posts:
    3,229
    In the MC's User's Guide, I talk about the SetTargetPosition() function to have the character move towards a target. That's on page 30.

    If you want to control the rotation and position at a lower level (meaning we ignore animation-based movement), I talk about that in the Actor Controller's Guide (page 7).
    SetPosition()
    SetRotation()

    Your IDE's Object Browser is a great resource for looking at the function descriptions and arguments.
     
    rubble1, StayUpLate and TeagansDad like this.
  4. Tryz

    Tryz

    Joined:
    Apr 22, 2013
    Posts:
    3,229
    Please email tim@ootii.com the project. It's easier for me to look at what's going on with the setup directly vs. trying to reproduce it... and telling you I can't. :)
     
  5. PiterQ70

    PiterQ70

    Joined:
    Mar 3, 2015
    Posts:
    59
    OK this is clear form me now :) If I need this I will try make custom motion.
     
  6. PiterQ70

    PiterQ70

    Joined:
    Mar 3, 2015
    Posts:
    59
    OK I will tommorow
     
  7. IsntCo

    IsntCo

    Joined:
    Apr 12, 2014
    Posts:
    141
    Perfect, thanks!
     
    Tryz likes this.
  8. magique

    magique

    Joined:
    May 2, 2014
    Posts:
    3,784
    @Tryz Is there some way to adjust the running of a character when in sword/shield combat mode? Walking looks fine because the character is cautiously moving in a combat-like stance and it looks good, but when running it looks like the character is bow-legged and all derpy. I see that there is an Upper mask on it, but the legs still go all wonky and it looks really bad.
     
  9. Tryz

    Tryz

    Joined:
    Apr 22, 2013
    Posts:
    3,229
    I think what you're talking about is the gap between the character's legs as he runs. That's Mixamo's "sword and shield run" animation found here:
    Assets\ootii\Assets\MotionControllerPacks\SwordShield\Content\Animations\Mixamo


    You can try a couple of things to get it to your liking:

    1. Adjust the avatar to rotate the legs closer together following Unity's guide.

    2. Replace the animation with something you like. For example, you could use my standard "RunForward" animation in the blend tree for "SwordShield" blend tree in the walk/run state machine you're using.

     
  10. magique

    magique

    Joined:
    May 2, 2014
    Posts:
    3,784
    Yeah, that's what I was thinking about trying. I've got the Kubold sword & shield animations so I might try those instead. Thanks for the advice.
     
    Tryz likes this.
  11. hoodoo

    hoodoo

    Joined:
    Oct 19, 2012
    Posts:
    150
    Question about using MC NPC characters with Emerald AI: Can Emerald AI drive the motion of the NPC characters while using MC to move and animate? I haven’t found any tutorials on how to set this up. I want my NPC to use the ootii shooter pack as well.
     
  12. Tryz

    Tryz

    Joined:
    Apr 22, 2013
    Posts:
    3,229
    I haven't used Emerald AI, but anything can drive the motions of the MC. You just have to call the functions I talk about in the User's Guide (page 26+):

    mMotionController.ActivateMotion(...);
    mMotionController.SetTargetPosition(...);
    mMotionController.ClearTarget();
     
    hoodoo likes this.
  13. rubble1

    rubble1

    Joined:
    Apr 25, 2010
    Posts:
    81
    Thanks, that was really helpful.
    It is turning to face the target now, but now it won't stop.

    I am modifying your existing flying motion so that it follows a target to guide its flight. I'd like to do this all in a motion itself. I actually had this working outside the MC, but I want to build it back in now to make the interactions more fluid.

    In your flight motion, it's all pretty neatly put into the Update function. I also looked at the Basic Idle Focus motion, but didn't quite understand all that was going on just yet.

    Also, being that this is following a target, Is there a simple way I can just reference that target object in the motion itself? Right now I'm calling it by name, but it would be super useful if I could change it during gameplay.

    Here's what I'm doing:

    Code (CSharp):
    1.             //find the vector pointing from our position to the target
    2.             TargetPosition = Target.transform.position;
    3.             //create the rotation we need to be in to look at the target
    4.             TargetDistance = (TargetPosition - mActorController.Transform.position).normalized;
    5.             //rotate us over time according to speed until we are in the required rotation
    6.             TargetOrientation = Quaternion.LookRotation(TargetDistance);
    7.          
    8.             //mMotionController.SetTargetRotation(Quaternion.LookRotation(TargetDistance));
    9.  
    10.          
    11.             Quaternion mRotation = Quaternion.Slerp(mActorController.Yaw, TargetOrientation, Time.deltaTime * RotationSpeed);
    12.             Quaternion mTilt = Quaternion.Slerp(mActorController.Tilt, TargetOrientation, Time.deltaTime * RotationSpeed);
    13.  
    14.             mActorController.Rotate(mRotation, mTilt);
     
  14. Tryz

    Tryz

    Joined:
    Apr 22, 2013
    Posts:
    3,229
    I'm not really sure what you mean. If you want it to stop, you'd stop calling mActorController.SetRotation() or mActorController.Rotate().

    If you're using mMotionController.SetTargetRotation(), you can just call mMotionController.ClearTarget();

    Maybe I'm missing something. :)

    Each motion is it's own entity. So, your motion could have a target object you create and reference.

    The MC and AC both use Vector3 for position and Quaternions for rotation. So, there's no transform 'target' that would be set. You would update the position and rotation functions when a change is needed.

    I think that's what you're asking.
     
  15. Weblox

    Weblox

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

    I just stumbled on the brandnew Integration video that you made for Inventory Pro. Thank you so much for doing this. I didn't follow along yet, but will try it out ASAP. :D

    Also I did go through the spellcasting demo scene and added the required motions to the Npcs motion list and found everything now working smoothly and as expected. This now ofc feels a lot better.

    For anyone that had Issues with the Malbers HAP 3 Integration, he also updated his Integration Package to work with the new HAP Update aswell. I have tried the Integration demo scene and now everything here is working nice and well also.

    Again, thanks a lot for all your effort and keep up the good work ! :p
     
    Last edited: Oct 21, 2018
    hopeful and Tryz like this.
  16. PiterQ70

    PiterQ70

    Joined:
    Mar 3, 2015
    Posts:
    59
    Where is MountPoint script ?
     
  17. Tryz

    Tryz

    Joined:
    Apr 22, 2013
    Posts:
    3,229
    Mount Points is another asset I sell for attaching weapons, armor, clothing, etc.
     
  18. PiterQ70

    PiterQ70

    Joined:
    Mar 3, 2015
    Posts:
    59
    Ahh ok :)
    So I was open MC and AC in U2018.3 beta and then I open in U2017.2. In 2017 work correctly but in 2018 animator doesn't have mixamo animations attached. Also what I see is when we Add AC package to character without attached animator, there is option "Create Animator" but doesn't work :) But I open two projects and setup as should be.
    I have question about arrow projectile. I think this add instance to scene but I don't see this in hand bone, I don't have time investigate but probably instance is in bow? How this work? Thanks :)
     
  19. Tryz

    Tryz

    Joined:
    Apr 22, 2013
    Posts:
    3,229
    Because 'beta' versions change so much and have Unity bugs, I don't test with them. Once Unity 2018.3 is released, I'll confirm it works.

    The Basic Ranged Attack has a CreateProjectile() function. In there, I look for the resource path of the arrow a couple of different ways and pass it to the bow for creation.

    Check out CreateProjectile() in BasicRangedAttack.cs and you should be able to follow the flow.
     
    PiterQ70 likes this.
  20. IsntCo

    IsntCo

    Joined:
    Apr 12, 2014
    Posts:
    141
    @Tryz Using the Activate Motion task in Behavior Designer is giving me this error:

    NullReferenceException: Object reference not set to an instance of an object
    com.ootii.Integrations.BehaviorDesigner.ActivateMessage.OnUpdate () (at Assets/ootii/_Integrations/MotionController/Opsive/BehaviorDesigner/Code/Actions/ActivateMotion.cs:151)
    BehaviorDesigner.Runtime.BehaviorManager.RunTask (BehaviorDesigner.Runtime.BehaviorTree behaviorTree, Int32 taskIndex, Int32 stackIndex, TaskStatus previousStatus)
    BehaviorDesigner.Runtime.BehaviorManager.Tick (BehaviorDesigner.Runtime.BehaviorTree behaviorTree)
    BehaviorDesigner.Runtime.BehaviorManager.Tick ()
    BehaviorDesigner.Runtime.BehaviorManager.Update ()

    My motion:

    https://i.gyazo.com/9014f7a1cb9c19b562c07ad9ca946c14.png
    (Note: I have tried clearing out the Action Alias section as well)

    My Behavior:

    https://i.gyazo.com/496d65f5114a95478162f2db8125f129.png

    My animation:

    https://i.gyazo.com/0745e25bc5d82f970c7587cf1094b646.png

    What am I doing wrong?
     
  21. TeagansDad

    TeagansDad

    Joined:
    Nov 17, 2012
    Posts:
    871
    @Appminis - Line 151 in my version of the ActivateMotion.cs script for the BD integration reads:

    Code (CSharp):
    1. if (!mIsActive && mMotion.IsActive)
    In the OnAwake() function of this BD task, it attempts to get the specified motion and then stores the reference in "mMotion":

    Code (CSharp):
    1. mMotion = mMotionController.GetMotion(LayerIndex.Value, Motion.Value);
    When mMotion.IsActive is checked at the start of OnUpdate(), it's throwing a NullReferenceException because the GetMotion() call in OnAwake() did not find the motion named "Sit" on Layer 0.

    Is your "Sit" motion on Motion Layer 0 of the Motion Controller?
     
  22. IsntCo

    IsntCo

    Joined:
    Apr 12, 2014
    Posts:
    141
    @TeagansDad Yep! We have the same Line 151.

    From what I can tell, its on Layer 0 (Base Layer), unless Layer 0 doesn't work with substates?

    https://i.gyazo.com/4252a2e4066dc65e8163b2b0cf2bb325.png


    Thanks!
     
    Last edited: Oct 22, 2018
  23. TeagansDad

    TeagansDad

    Joined:
    Nov 17, 2012
    Posts:
    871
    We're talking about two different things here. :) Well, I guess it could actually be three things: the animator state named "Sit," the AnimationClip named "Sit," and the SimpleMotion named "Sit."

    Your "Sit" animator state is on Layer 0 of your AnimatorController. It directly references the "Sit" AnimationClip.

    The SimpleMotion named "Sit" is managed by the MotionController component and is added to one of its Motion Layers. The motion doesn't directly reference any animator states or Animation Clips (at least not in the sense of dragging an object into a field on its inspector and thus storing a GUID reference to a Unity object). It uses that integer Motion Phase value to transition to an animator state.

    Anyway, if your "Sit" animator state is on Layer 0 of the animator controller, then (generally) your SimpleMotion named "sit" should be on Motion Layer 0 on the Motion Controller (the one named "Base Layer" in this image):

    upload_2018-10-22_13-15-8.png

    The ActivateMotion task is looking for the motion named "Sit" on MotionLayer 0; if it's throwing a NullReferenceException then this is the most likely cause.
     
  24. IsntCo

    IsntCo

    Joined:
    Apr 12, 2014
    Posts:
    141
    @TeagansDad Oh I see - I believe "Sit" is on MotionLayer 0:

    https://i.gyazo.com/1bb0bca31a91f9f59cfa7dad6b9f5c81.png

    The Layer Upper Body is empty, so unless I'm missing something, this is Layer 0.

    Any other ideas? :)
     
  25. TeagansDad

    TeagansDad

    Joined:
    Nov 17, 2012
    Posts:
    871
    Drat.

    You are correct.

    Not without loading up a project with Motion Controller + Behavior Designer and trying to replicate the problem. :( I'll give that a shot when I have a chance. Hopefully in the next couple of hours, but no promises.
     
  26. IsntCo

    IsntCo

    Joined:
    Apr 12, 2014
    Posts:
    141
    Appreciate that!
    Please let me know if any additional information/screenshots would help. I'm using the latest Behavior Designer Ootii actions from the Ootii Vault, latest Behavior Designer and Motion Controller. Just followed the few steps on making a simple motion.
     
  27. TeagansDad

    TeagansDad

    Joined:
    Nov 17, 2012
    Posts:
    871
    Luckily, I had a project with all of the necessary assets imported already set up on my computer!

    And I can't replicate the issue you're having. It works fine when I try it. The only thing that I can to do make it throw the NullReferenceException at that line is to change the name of the motion to one that does not exist in the list of motions on the designated layer.

    So check that there are no trailing spaces on your motion name... if it's "Sit " instead of "Sit" then it will throw the error.

    Also, add this code to the very start of the OnUpdate() method in ActivateMotion.cs (before any other code):

    Code (CSharp):
    1. if (!mIsActive && mMotion == null)
    2.             {
    3.                 Debug.LogErrorFormat("Task Failed: Unable to find a motion named {0}", Motion.Value);
    4.                 return TaskStatus.Failure;
    5.             }
    That will at least allow the task to fail gracefully if the motion can't be found.

    You could also change line 109 from:
    Code (CSharp):
    1. mMotion = mMotionController.GetMotion(LayerIndex.Value, Motion.Value);
    to:

    Code (CSharp):
    1. mMotion = mMotionController.GetMotion(LayerIndex.Value, Motion.Value.Trim());
    This will remove any trailing spaces from the motion name entered into the task's inspector.
     
    Tryz and hopeful like this.
  28. IsntCo

    IsntCo

    Joined:
    Apr 12, 2014
    Posts:
    141
    Looks like it was a naming issue, thanks! :)
     
    Tryz and TeagansDad like this.
  29. IsntCo

    IsntCo

    Joined:
    Apr 12, 2014
    Posts:
    141
    @TeagansDad Do you know if the only way to make the task register as Success is by a hardcoded Exit Time? I want it just to trigger the motion (which happens to loop) and then I define the sequence of Behavior events before he stops that motion.
     
  30. hopeful

    hopeful

    Joined:
    Nov 20, 2013
    Posts:
    5,070
    Extra brownie points for you! GJ! :)
     
    TeagansDad likes this.
  31. TeagansDad

    TeagansDad

    Joined:
    Nov 17, 2012
    Posts:
    871
    Glad it was an easy fix. :)

    The "Completion Index" field determines what condition will return Success:
    0 = Immediate
    1 = Activated
    2 = Deactivated
    3 = Motion Time
    4 = State Time

    (The only way to know this is to look into the source code for ActivateMotion.cs; you didn't miss anything.)

    So you'll want to leave the Completion Index as 2 (Deactivated) so that the task will continue to return "Running" until the motion is deactivated. Then once your behaviour tree has determined that he should stop sitting, run the DeactivateMotion task. So you'd put that logic in a branch of the tree that is at the same level as where you're activating the Sit motion, but to the left of it and with a "Lower Priority" conditional abort on its composite so that it will be re-evaluated while the ActivateMotion: Sit is running.
     
    FargleBargle and Tryz like this.
  32. IsntCo

    IsntCo

    Joined:
    Apr 12, 2014
    Posts:
    141
    Ah, I would have had NO idea! @Tryz would be good to add to the documentation :)

    Thanks again, @TeagansDad
     
  33. TeagansDad

    TeagansDad

    Joined:
    Nov 17, 2012
    Posts:
    871
    I would be inclined to create a MotionCompletionType enum for that condition, for which BD would just create a dropdown list. That way, users wouldn't really need to refer to documentation.

    However, the BD tasks were a fairly quick-and-dirty conversion from the NodeCanvas tasks. There are a number of things in that set of tasks that could be streamlined to better fit how BD works. I've thought about tidying them up, but I also haven't really felt like actually doing so. ;)
     
    Tryz likes this.
  34. IsntCo

    IsntCo

    Joined:
    Apr 12, 2014
    Posts:
    141
    Ah ok, fair enough!
    By the way, I think I've narrowed down the issue further that I had. I am sync'ing a Playmaker String with a Behavior Designer String to indicate which Motion to use. In Behavior Designer, this shared string looks correct when I check the variables during runtime. But for some reason, Activate Motion doesn't like it. If I manually enter a Motion name or I create a string variable in BD and enter the motion name, it works fine. I'll need to keep investigating :)
     
  35. Tryz

    Tryz

    Joined:
    Apr 22, 2013
    Posts:
    3,229
    Make sure there's not a hidden character in the string... space, tab, etc.
     
  36. IsntCo

    IsntCo

    Joined:
    Apr 12, 2014
    Posts:
    141
    Oddly there are no visual spaces. For anyone in the future that may have this issue and is using Playmaker, it looks like the "Set String" action gives this weird issue and it is resolved if you instead use "Set FSM String"
     
    Tryz likes this.
  37. nosty3

    nosty3

    Joined:
    Jan 23, 2015
    Posts:
    2
    Hi,
    I use BasicWalkRunPivot motion (MC v. 2.75) and I found a strage bug:

    1. Run game in Unity. Actor can walk and run correctly.
    2. Set "Use Transform" flag in Actor Controller
    3. Move an actor (in Scene window)
    4. Clear "Use Transform" flag

    Now I can walk but I can't run.
    I checked that "Run" input works fine but InputMagnitude and InputX are always 0.5f.

    I can't find a reason.
    Thank you for any help.
     
  38. Tryz

    Tryz

    Joined:
    Apr 22, 2013
    Posts:
    3,229
    The MC's "TargetNormalizedSpeed" property is probably getting set to 0.5 when the "Use Transform" is active. This happens because of the psuedo input that is generated.

    When you uncheck the "Use Transform" (in code), you want to set MC.TargetNormalizedSpeed to 1.

    Since the AC really doesn't know about the MC, I can't change it there when you change "Use Transform" manually in the inspector.
     
  39. nosty3

    nosty3

    Joined:
    Jan 23, 2015
    Posts:
    2
    Thank you Tryz!
    That was it.
     
    Tryz likes this.
  40. rubble1

    rubble1

    Joined:
    Apr 25, 2010
    Posts:
    81

    Oh, I see. I was overcomplicating things, that was actually much simpler than I'd thought.
    What you said solves most of my problem.
    But just for this instance, I need it to be able to rotate on the other axis (as in a regular unity LookAt).

    What I'm using is this:

    Code (CSharp):
    1. public GameObject Target = GameObject.Find("MyTargetObject");
    2.  
    3. public override void Update(float rDeltaTime, int rUpdateIndex)
    4.         {
    5.  
    6. TargetPosition = Target.transform.position;
    7.  
    8. mActorController.SetRotation(Quaternion.LookRotation(TargetPosition));
    9.  
    10. }
    11.  
    12.  
    How do I do the MC or AC equivalent of this:

    Code (CSharp):
    1. transform.LookAt(Target);
    For characters and in most likely situations, what you suggested is perfect. You can simply point the character at a target (I guess provided it's on the same ground plane). However, my situation needs this character to be able to rotate around the way you'd see on a regular unity LookAt function. I remember seeing something either in the documentation or in the AC/MC about it locking one of the axes. Perhaps that's the problem I'm having.

    To elaborate a little more. When I'm on the ground, if I activate this "targeting motion", then the character will change his orientation (Y or vertical axis) to face the target. The other axis (X or the one running through his side), is unresponsive here.
    However, if the character is in the air when the motion is activated, then yes, then vertical movement of the target does affect the other axis, but it's a little wonky. I'd say it looks a lot like a Gimbal lock. Is there an MC/AC equivalent, or is there a simple way to override it, just for that motion?

    Thanks again
     
  41. IsntCo

    IsntCo

    Joined:
    Apr 12, 2014
    Posts:
    141
    Is it possible to use Walk Run Pivot with an AI controlled Nav Mesh character (which uses 'Use Transform' in Actor Controller) instead of Basic Walk Run ?

    Trying to find ways for my NPCs to look less rigid and being controlled by the nav mesh agent (or in my case, using A*, the AI Path component) and they don't look very smooth due to the lack of transitions.
     
  42. TeagansDad

    TeagansDad

    Joined:
    Nov 17, 2012
    Posts:
    871
    @Appminis - yes, you can use the old WalkRunPivot_v2 motion with the NavmeshAgent.

    The reason why the Basic WalkRun motions lack those transitions is because they're designed so that you can use different animation sets with the same motions and many sets don't include those transition clips.

    I've been planning to build an extended motion that can use the motion form to select from different animation sets and which has the transitions, but I haven't gotten to it yet and it hasn't been a high priority for me. I'll share it whenever I get around to building it though
     
    Tryz likes this.
  43. Tryz

    Tryz

    Joined:
    Apr 22, 2013
    Posts:
    3,229
    Use Unity's Quaternion.LookRotation function. Their documentation gives a perfect example.

    If you look at the AC's SetRotation() function, it can have two arguments: one for yaw and one for tilt. I did it this way because 95% of the time, we don't want the character to tilt... we just want them to turn.

    My targeting approach is only meant for "on the ground". If you're wanting something that supports full 3DOF, you'll want to create something a bit beefier.
     
    rubble1 likes this.
  44. IsntCo

    IsntCo

    Joined:
    Apr 12, 2014
    Posts:
    141
    Ah ok, thanks! I did try out using just the Walk Run Pivot and it seems my NPC doesn't utilize the transitions. Perhaps I need to do something specific with the AI agent? Any tips appreciated :)
     
  45. Tryz

    Tryz

    Joined:
    Apr 22, 2013
    Posts:
    3,229
    Typically you wouldn't use Walk Run Pivot with NPCs. The reason is that with WRP input is relative to the camera and that relative input determines how the character reacts. For PCs, think of it like this...

    If the camera is orbited to face the opposite direction the character model is facing and you press 'W', the character pivots 180 degrees (making him face the direction of the camera), then he walks forward.



    NPCs typically don't have a camera. So, it usually doesn't make sense to do this.

    [EDIT]
    There are cases where people have used the 'pivot' version with NPCs, but it won't do the transitions (with my AI) because my NPC AI code only causes the NPCs to move 'forward'.

    To do this, ensure the MC's "Camera Rig" field is empty and the "Find" checkbox is unchecked. Since there's no camera, I'll allow the NPC to rotate from the AI code.
     
    Last edited: Oct 25, 2018
    StayUpLate and TeagansDad like this.
  46. magique

    magique

    Joined:
    May 2, 2014
    Posts:
    3,784
    @Tryz When using Field of Attack mode, I'm seeing an issue where if the player is too close to an enemy that he never hits it, but the weapon is slicing through the enemy AI so I would expect the attack to succeed. Is there some way to tweak the settings so these close up attacks will hit? I'm using Emerald AI enemies.
     
  47. IsntCo

    IsntCo

    Joined:
    Apr 12, 2014
    Posts:
    141
    Are you saying if I keep the Camera Rig field empty and Find unchecked that Walk Run Pivot will use the transitions? Cant seem to get that to work. Or do you mean that I can extend via code? Appreciate it! Just want to get the NPCs looking a bit smoother :)
     
  48. Tryz

    Tryz

    Joined:
    Apr 22, 2013
    Posts:
    3,229
    Let's take it in steps:

    1. You can use Walk Run Pivot with NPCs if you do what I mention above.

    2. Now that Walk Run Pivot works, Walk Run Pivot transitions only work because the character faces one direction and the movement direction forces them to go another (ie the 90-degree pivot or the 180-degree pivot).

    As an example, open up my demo_NavMesh scene. Then, select PlayerBot and remove the Basic Walk Run Strafe motion. Add the Walk Run Pivot motion. On the MC itself, ensure the "Camera Rig" is empty and its "Find" check box is unchecked. Now, hit 'play'.

    If you watch carefully, you can see he starts off with a transition to walking. However, the AI quickly rotates him forward and there's no need to transition.



    So, the changes I mention allow you to use Walk Run Pivot with NPCs, but the transitions themselves occur based on the direction your AI gives vs. the character's current direction. That part is up to your custom AI.
     
  49. Tryz

    Tryz

    Joined:
    Apr 22, 2013
    Posts:
    3,229
    I'm not seeing it here, but it could be based on your setup.

    I opened up my demo_SSMP scene and made it so the characters could get really close:


    Then I swung and the enemy was hit:


    The way the FOA works is that I take the Combatant component's "Combat Transform" position along with the "Combat Offset" and use that as the center point or "Combat Origin".



    Then, I use the combat origin and weapon's range to call Unity's OverlapSphere() function to get everything in range. Finally, I get the closest point to the colliders in range.

    So, a couple of things could be happening...

    1. The Combat Origin may not be where you expect it to be. For example, the animation may move it more forward than you think.

    2. Your weapon's range may be too small. In this case, the overlap won't happen.

    The best thing to do is to put a break point in the CombatManager's QueryCombatTargets() function (at line 104) and see what the origin and range are. Then, you can see what gets returned from the OverlapSphere() call. From there, you can see what is caught and what is thrown back.
     
    hopeful and TeagansDad like this.
  50. magique

    magique

    Joined:
    May 2, 2014
    Posts:
    3,784
    Is this in any way related to the target's specific details? Since I'm using Emerald AI maybe that could be a factor?
     
unityunity