Search Unity

Third Person Controller - Third Person, AI, Multiplayer, Mobile Framework

Discussion in 'Assets and Asset Store' started by opsive, Jan 21, 2015.

Thread Status:
Not open for further replies.
  1. creat327

    creat327

    Joined:
    Mar 19, 2009
    Posts:
    1,203
    On UWP built? I don't think that exists there...
     
  2. opsive

    opsive

    Joined:
    Mar 15, 2010
    Posts:
    4,754
    For UWP it's in System, for .Net standard it's System.Reflection.
     
  3. liufeizhou

    liufeizhou

    Joined:
    Feb 10, 2018
    Posts:
    2
    Hello, I want to know how the magic should be added, how to release, there is no magic module in the demo?
     
  4. opsive

    opsive

    Joined:
    Mar 15, 2010
    Posts:
    4,754
    Take a look at the RPG character within the clean scene. This character has a two sets of items which use the MagicItem component.
     
  5. Cyrill9

    Cyrill9

    Joined:
    Oct 7, 2016
    Posts:
    8
    Excuse me for the the amateur question, but I cannot see the way I can tweak some camera settings. I used the default character from the standart unity asset, and with the help of the tutorial set it up with this asset. My goal is to prevent the character from turning his body to the camera looking direction when he's staying idle, and the player only moves the mouse around.
     
  6. opsive

    opsive

    Joined:
    Mar 15, 2010
    Posts:
    4,754
    It sounds like you want to use the adventure movement type. This is set on the RigidbodyCharacterController. In this case you don't need to change any camera settings but they are changed within camera states.
     
  7. creat327

    creat327

    Joined:
    Mar 19, 2009
    Posts:
    1,203
    @opsive a few days waiting for the private reply...
     
  8. opsive

    opsive

    Joined:
    Mar 15, 2010
    Posts:
    4,754
    I just replied :)
     
  9. nightowlgaming

    nightowlgaming

    Joined:
    Aug 30, 2017
    Posts:
    2
  10. opsive

    opsive

    Joined:
    Mar 15, 2010
    Posts:
    4,754
    Hmm.. Unfortunately I don't have any control of that so you'll have to wait for Unity to get back to you. If you're using the new asset store you can click on "Shop on Old Store" on the top right and see if that works:

    old.PNG
     
  11. closetgeekshow

    closetgeekshow

    Joined:
    Jun 6, 2014
    Posts:
    108
    I'm having an issue trying to figure out how to make the Ride ability work with my character. I'm using the Stardudes asset for the character and have copied Blitz from the Clean Scene into my own. Currently my guy is sitting inside the horse, what options do I tweak to fix the character's positioning?

    Eventually I want to add in different mounts but at the moment I'm having trouble with just the default horse. mount issue.PNG
     
  12. opsive

    opsive

    Joined:
    Mar 15, 2010
    Posts:
    4,754
    The mounting animations use root motion so in this case it looks like you'll need to use a set of mount animations that more closely match your character's rig.
     
  13. closetgeekshow

    closetgeekshow

    Joined:
    Jun 6, 2014
    Posts:
    108
    Would creating a new ability that mirrors how Ride works but places the character at a specific point within the Rideable Object be a better course of action? I'm less concerned with the mounting animations themselves and care more that the character is placed in the correct location on the rideable object.
     
  14. opsive

    opsive

    Joined:
    Mar 15, 2010
    Posts:
    4,754
    That would also work :)

    You could subclass the Ride ability and then position the character within the Move method.
     
  15. closetgeekshow

    closetgeekshow

    Joined:
    Jun 6, 2014
    Posts:
    108
    Do I need to download the source version to be able to see the existing code for the Ride ability?
     
  16. opsive

    opsive

    Joined:
    Mar 15, 2010
    Posts:
    4,754
  17. lmakor

    lmakor

    Joined:
    Oct 31, 2016
    Posts:
    14
    hi!
    does this character controller support box-based character colliders (as opposed to capsule based ones)?
     
  18. opsive

    opsive

    Joined:
    Mar 15, 2010
    Posts:
    4,754
    The controller does require a CapsuleCollider, though it doesn't have to be oriented in the positive y direction. Box colliders are hard to support because there is a hard edge on the bottom corners of the box which doesn't work as well for collision detection. You can add extra colliders to the character though so as long as you have a single CapsuleCollider you'd be good to go.
     
  19. SecretAnorak

    SecretAnorak

    Joined:
    Mar 19, 2014
    Posts:
    172
    Hi there. If anyone fancies trying out UMA with Opsive's third person controller:
     
    mwituni, EdWaters, Teila and 2 others like this.
  20. vitaminsketch101

    vitaminsketch101

    Joined:
    Mar 27, 2018
    Posts:
    2
    I've notice you've done a whole rebuild to the animation set compared to your tutorial video and changed a lot of the interfaces, options,and settings. I know I can customize any animation with Mechanime but I can't seem to get it to react or do anything you show in your videos without going into the script and reading miles of code to figure out where things need to go and what I need to do to make them work with what-ever you have going on in there now. Is there a plan to expand the Manual to fit these changes and to replace the tutorials with ones that go with your new setup or should I just go out and get InVector? I can't get the character to pick up an item let alone get anything working because the information in the manual that is so well documented on the sections I need to use to Create objects is 4 sentences if a paragraph, No deep explanation, and carries no reference but the game name to the new format.
     
  21. vitaminsketch101

    vitaminsketch101

    Joined:
    Mar 27, 2018
    Posts:
    2
    Better question is there a way I can download your older version? You know the one I hear all the good things about?
     
  22. opsive

    opsive

    Joined:
    Mar 15, 2010
    Posts:
    4,754
    Is there a particular video that you are referring to? The character/item creation videos should be up to date. The only one that I know of which has different values is the ability one that adds the Height Change ability (the correct values are ones listed below, copied from the clean scene):

    Capture.PNG

    You can download older versions source code on this page but it doesn't include the rest of the files so may not work. There isn't a way to download old versions on the Asset Store.
     
    Last edited: Mar 29, 2018
  23. magique

    magique

    Joined:
    May 2, 2014
    Posts:
    3,784
    I'm trying the latest version out on the Wii U platform and I'm getting the following message spammed to the console when running on the hardware:

    ExecutionEngineException: Attempting to JIT compile method '(wrapper delegate-invoke) <Module>:invoke_Vector3__this__ ()' while running with --aot-only.
    at Opsive.ThirdPersonController.SharedMethod`1[UnityEngine.Vector3].Invoke () [0x00000] in <filename unknown>:0
    at Opsive.ThirdPersonController.CharacterIK.LookAtTarget () [0x00000] in <filename unknown>:0
    at Opsive.ThirdPersonController.CharacterIK.OnAnimatorIK (Int32 layerIndex) [0x00000] in <filename unknown>:0
     
  24. opsive

    opsive

    Joined:
    Mar 15, 2010
    Posts:
    4,754
    I just tried a WebGL build (which is AOT) and it worked. Did you make sure to import the source?
     
  25. magique

    magique

    Joined:
    May 2, 2014
    Posts:
    3,784
    No, I didn't import the source. It's been a while since I used this and I forgot that was necessary for this issue. Thanks for the quick response as always. I'm really pleased to be back using your controller. I've gone round and round with other potential solutions only to be disappointed time and time again. But I now have TPC up and running with UMA 2 and it's running as smooth as can be.

    I am still seeing one thing though that I remember from a long time ago. When my character jumps there is a frame rate drop of 10-15 on Wii U. I don't remember there ever being a fix for this, but maybe we can get that sorted out in the near future.
     
  26. opsive

    opsive

    Joined:
    Mar 15, 2010
    Posts:
    4,754
    That's great to hear. If you profile the framerate drop it should help pinpoint the bottleneck, but generally when there's a framerate drop it's related to the animator updating. In 2017.2 there is a new Physics.autoSyncTransforms method which should help speed this process up though I haven't tried it yet.
     
  27. magique

    magique

    Joined:
    May 2, 2014
    Posts:
    3,784
    I'll do some profiling when I get some time and I'll let you know the results.

    I have to use 5.6 for the time being. The 2017 version for Wii U is still not ready for prime time.
     
  28. magique

    magique

    Joined:
    May 2, 2014
    Posts:
    3,784
    @opsive It's been a while since I've used this so I'm sorry if I've asked this before. I'm going to integrate with Emerald AI and I'm not sure where to begin to look for the interfaces where I can have the AI damage the player and vice versa. Do you have some docs somewhere on the basics of this sort of integration?
     
  29. opsive

    opsive

    Joined:
    Mar 15, 2010
    Posts:
    4,754
  30. magique

    magique

    Joined:
    May 2, 2014
    Posts:
    3,784
  31. magique

    magique

    Joined:
    May 2, 2014
    Posts:
    3,784
    @opsive I didn't have much time to do the Emerald AI integration, but I was able to easily get the player attacking the AI using a modified version of the Damaged class sample. I suspect the rest should be just as easy.
     
  32. magique

    magique

    Joined:
    May 2, 2014
    Posts:
    3,784
    @opsive, I'm having an issue with my melee weapons. When I attack and the weapon hits anything it stops the attack animation. So it seems that when the sword collider hits anything, the attack completes but doesn't play the full animation. This doesn't look good visually and feels wrong as well. I'd like to be able to be right up against an opponent and take full swings whether they hit or not. How can I insure the attacks always follow through even when hitting an obstruction?
     
  33. magique

    magique

    Joined:
    May 2, 2014
    Posts:
    3,784
    Also, how can I get the controller to honor the full motion for an attack? I've got Sword & Shield animset pro and when I assign the attacks to the various layers, the character still remains rooted in place when attacking and only the upper body uses the attack animation, but I put the animation reference in all layers. But maybe I missed something.
     
  34. TeagansDad

    TeagansDad

    Joined:
    Nov 17, 2012
    Posts:
    871
    @magique - Did you check the base layer in each of the animation states in the Animation Options section of the Melee Weapon component? I think it's called Animation Options; it lists Aim, Default, Equip, Unequip, Recoil, etc

    I know how to fix the issue in your previous question... But I forget what the setting is called. I think it's on the Melee Weapon component too. I'll be at my computer in about an hour; if you haven't received an official answer by then I'll load up a project and get the setting for you.
     
    magique likes this.
  35. magique

    magique

    Joined:
    May 2, 2014
    Posts:
    3,784
    I don't believe I did that. I'll check that tonight when I get back to my dev computer.
     
  36. TeagansDad

    TeagansDad

    Joined:
    Nov 17, 2012
    Posts:
    871
    The setting you want is Wait For End Use Event, which is under Attack Options on the MeleeWeapon component (near the bottom of the inspector).

    As for the other... I was close, the section is Character Animator Options, in the Use States:

    upload_2018-4-4_9-36-53.png

    In the Layer field, ensure both "Base" and "Upper Body" are selected for each of the attacks in the chain.

    With Sword & Shield Animset Pro, you'll be wanting all of the animations to run on both of these layers, as the upper body is at a 35-45 degree rotation when in the "ready" combat stance (from which all of the attack, damage, etc animations start).
     
    magique and opsive like this.
  37. opsive

    opsive

    Joined:
    Mar 15, 2010
    Posts:
    4,754
    Thanks for helping!

    In addition, if you never want to use the recoil animations you can remove the recoil state name under the Recoil foldout. An empty state name won't be called.
     
    magique likes this.
  38. magique

    magique

    Joined:
    May 2, 2014
    Posts:
    3,784
    Awesome. Thanks for all the help from both of you. I think this will get me past the issues for sure.
     
  39. magique

    magique

    Joined:
    May 2, 2014
    Posts:
    3,784
    Btw, I'm still loving the switch back to TPC. It's working great for me and I feel like I'm back in control again.
     
    opsive likes this.
  40. magique

    magique

    Joined:
    May 2, 2014
    Posts:
    3,784
    @TeagansDad , @opsive Both suggestions worked perfectly and now my swordsman looks and feels a lot better. Thanks for all the help.
     
  41. TeagansDad

    TeagansDad

    Joined:
    Nov 17, 2012
    Posts:
    871
    @magique - you're welcome!

    One other thing I should mention... I found that I needed to turn off the Aim IK when the sword & shield are equipped, as it often made the sword arm move in awkward ways. That goes for the rest of Kubold's sword animation sets as well -- and probably any others that use a stance with a similar torso rotation (such as Mixamo).
     
  42. magique

    magique

    Joined:
    May 2, 2014
    Posts:
    3,784
    I'm seeing some errors after attacking and moving around for a little bit.

    Infinity or NaN floating point numbers appear when calculating the transform matrix for a Collider. Scene hierarchy path "Mercivus/Root/Global/Position/Hips/RightUpLeg/RightLeg/RightFoot"
    Invalid parameter pos in Rigidbody.TransformChanged because it was infinity or NaN

    Assertion failed on expression: 'IsFinite(gain)'

    Assertion failed on expression: 'IsFinite(gain)'

    Infinity or NaN floating point numbers appear when calculating the transform matrix for a Collider. Scene hierarchy path

    "Mercivus/Root/Global/Position/Hips/RightUpLeg/RightLeg/RightFoot"
    UnityEngine.Transform:set_position(Vector3)
    Opsive.ThirdPersonController.CharacterIK:FixedUpdate() (at Assets/Third Person Controller/Scripts/Character/CharacterIK.cs:212)

    Note that I'm using a UMA 2 character.
     
  43. magique

    magique

    Joined:
    May 2, 2014
    Posts:
    3,784
    How do you do that? Is that an inspector setting somewhere? Do you mean the Can Aim flag? If so, then I agree and I already turned that off.
     
  44. magique

    magique

    Joined:
    May 2, 2014
    Posts:
    3,784
    Also, while the OnAnimatorItemEndUse works great so the animation completes, it has undesirable side effects like continuing to damage the enemy well after the attack is complete. Because I have to move the event to the end of the animation for it to fully complete. Is there another event that will disable the weapon from causing damage, but still allow the animation to continue?

    [EDIT]
    I found the solution by setting the Single Hit Attack flag.
     
    Last edited: Apr 5, 2018
  45. magique

    magique

    Joined:
    May 2, 2014
    Posts:
    3,784
    One more thing I forgot how to do. There is a delay in between attacks and I'd like to reduce that to nearly zero if possible. I believe there is a way, but I can't remember how.

    [EDIT]
    I got it closer to what I wanted.
     
    Last edited: Apr 5, 2018
  46. magique

    magique

    Joined:
    May 2, 2014
    Posts:
    3,784
    I forgot about another issue. When I first start a scene with the character in it, he is somewhat rooted to the ground. I can walk and run, but it won't jump. It also only performs upper body attacks. But if I play with the controls and try attacking and jumping and moving simultaneously a few times then I can get it "unstuck" and then it starts behaving again.
     
  47. opsive

    opsive

    Joined:
    Mar 15, 2010
    Posts:
    4,754
    Are you able to tell me how to reproduce this one within a demo scene? Line 212 of CharacterIK points to the hip position containing a NaN:

    Code (csharp):
    1.  
    2.             m_Hips.position = m_HipsPosition;
    3.  
    However that error relates to the right foot. Is your rig setup correctly?

    Can you insert a breakpoint within Jump.CanStartAbility to determine why it's not starting?
     
  48. magique

    magique

    Joined:
    May 2, 2014
    Posts:
    3,784
    Probably not. I'll have to get back to this one later.

    This one is very interesting so far. I started debugging and the information is a dead end so far. Checking the Jump.CanStartAbility indicates that the ability can start because that function returns true. However, it never gets to the AbilityStarted function. Any advice on where it could get derailed in between these 2 functions?
     
  49. opsive

    opsive

    Joined:
    Mar 15, 2010
    Posts:
    4,754
    Did you replace the jump event? You'll need to make sure you also add the OnAnimatorStartJump event which actually makes the character jump.
     
  50. magique

    magique

    Joined:
    May 2, 2014
    Posts:
    3,784
    No, I didn't replace anything. I'll try the breakpoint and stepping through the code.
     
Thread Status:
Not open for further replies.
unityunity