Search Unity

  1. Unity 2020.2 has been released.
    Dismiss Notice
  2. Good news ✨ We have more Unite Now videos available for you to watch on-demand! Come check them out and ask our experts any questions!
    Dismiss Notice

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. opsive

    opsive

    Joined:
    Mar 15, 2010
    Posts:
    4,866
    It looks like you've made some changes to the tree - did it work when you first downloaded the sample integration? I would try again with a fresh project importing the following:

    Third Person Controller
    Behavior Designer
    Behavior Designer - Movement Pack
    Third Person Controller / Behavior Designer integration
    Third Person Controller / Behavior Designer sample
     
  2. lazygunn

    lazygunn

    Joined:
    Jul 24, 2011
    Posts:
    2,749
    Do you have an idea of the price of the shooter ai you have in the works and will there be an upgrade path? This isn't urgent it's just good to know what my useful unity junk might contain in the future. I'm actually more interested in how to implement AI in a game that isn't a bipedal shooter style or a flight/steering style but rather something in between and I'm wondering if taking on this asset properly along with your behaviour tree asset is the right way to go about it

    I guess I'm essentially looking at what is quite a common pattern in arcade games where distant movement takes on a more steering-style flight movement but moves to a 'battle circle' close up approach with fast forwards movement replaced with more strafing movement. As I have to approach this quite quickly I probably don't have time to invest in these for it right now but it represents a glaring hole in the unity asset store which I've, to my horror, realised I can't plug with cold hard cash so wondered if you'd considered a documented approach to this

    I just see endless AI solutions for traditional biped shooters and racing/flight games but there's definitely an alley for space invader who wants to punch you kind of games
     
  3. opsive

    opsive

    Joined:
    Mar 15, 2010
    Posts:
    4,866
    Since the Deathmatch Kit will require both the Third Person Controller and Behavior Designer it is going to be cheap - probably just a little bit more than the Behavior Designer addon packs.

    I think that the shooting aspect is the most popular so that's why you see all of those shooter kits. With that said, we already have plans for our next Third Person Controller / Behavior Designer addon asset and it won't be shooter focused at all. We want to get the Deathmatch Kit out before we start to talk about this next kit, but I think that you'll be really interested in this addon :)

    Our plans are to release version 1.3 of the Third Person Controller and then work on getting the Deathmatch Kit out. Once the Deathmatch Kit is released we will be working on both this second addon asset at the same time as UFPS 2. I do not think that the second addon asset will require as much work as the Deathmatch Kit because the Third Person Controller featureset should already contain mostly everything that we need - most of the time spent will be on designing the AI as well as the art assets.
     
  4. lazygunn

    lazygunn

    Joined:
    Jul 24, 2011
    Posts:
    2,749
    That sounds quite intriguing! I'm never in any huge rush cause I've always got a bunch of priorities higher than fine grain or even bullet points suggested/expected to/of me but a few hints either here or in private with an idea to hang up ambitions of approaching all my AI myself (please) and finally pick up behaviour designer properly and I'm yours
     
    opsive likes this.
  5. opsive

    opsive

    Joined:
    Mar 15, 2010
    Posts:
    4,866
    Can you send me a PM with a few features that you are looking for? I'll then be able to see if we're already planning on adding it to the Deathmatch Kit or our second addon idea.
     
  6. kilik128

    kilik128

    Joined:
    Jul 15, 2013
    Posts:
    888
    Yes maybie first try i have reset script link
    ok only reimport sample working thank's for help


    Code (CSharp):
    1. using UnityEngine;
    2. using System.Collections;
    3. using Opsive.ThirdPersonController;
    4.  
    5. public class BehaviorBot : MonoBehaviour {
    6.    
    7.     // Component references
    8.     protected GameObject m_GameObject;
    9.     protected Transform m_Transform;
    10.  
    11.     /// <summary>
    12.     /// Cache the component references and initialize the default values.
    13.     /// </summary>
    14.     protected virtual void Awake()
    15.     {
    16.         m_GameObject = gameObject;
    17.         m_Transform = transform;
    18.        
    19.         SharedManager.Register(this);
    20.  
    21.         // Register for OnRespawn so the health and sheild can be reset.
    22.         EventHandler.RegisterEvent(m_GameObject, "OnDeath",OnDeath);
    23.  
    24.     }
    25.  
    26.  
    27.     // Use this for initialization
    28.     void Start () {
    29.  
    30.    
    31.     }
    32.    
    33.     // Update is called once per frame
    34.     void Update () {
    35.    
    36.     }
    37.  
    38.     public void OnDeath(){
    39.  
    40.         Debug.Log ("Ikill bot");
    41.  
    42.     }
    43. }
    44.  
    this event system look amazing any info about this
     
    Last edited: Mar 27, 2016
  7. opsive

    opsive

    Joined:
    Mar 15, 2010
    Posts:
    4,866
  8. Menn007

    Menn007

    Joined:
    Sep 20, 2015
    Posts:
    23
    Hi,
    I am trying to ge the health of the player in Playmaker.
    Pretty simple right? Just add a Playmaker FSM to the player and add the "Get current Health" action and store the float value.

    strangly the value is always 0 ? While the healthbar at the top is fully loaded (100)
    Any idea why this is?

    best
    Menno
     
  9. opsive

    opsive

    Joined:
    Mar 15, 2010
    Posts:
    4,866
    I heard one other report of this within the past couple of days but I haven't been able to reproduce it, even with a fresh Third Person Controller 1.2.2 project. Can you download this sample scene and tell me what output you get? You should receive the following:

    Ethan : FSM : State 1 : DebugLog : 100
     
  10. Menn007

    Menn007

    Joined:
    Sep 20, 2015
    Posts:
    23
    Hi Justin,

    in the example file the value is still zero. :-/
    DebugLog : 0

    I am using playmaker 1.8
    and the latest Unity3D version
     
  11. opsive

    opsive

    Joined:
    Mar 15, 2010
    Posts:
    4,866
    Try the latest Playmaker version on the Integrations page - the version that I was testing wasn't the same as what was on the server. You should be good to go after getting this new set of files.
     
  12. Gametyme

    Gametyme

    Joined:
    May 7, 2014
    Posts:
    584
    Is it possible for you to add the option to run via joystick instead of pressing a button?
     
  13. opsive

    opsive

    Joined:
    Mar 15, 2010
    Posts:
    4,866
    Which button are you referring to? Running is more controlled by the Animator Controller rather than the joystick - a joystick will return a range of 0-1 and if it's one you can have the movement state within the Animator Controller run. If for example you add a joystick to the clean scene the character will run.
     
  14. Gametyme

    Gametyme

    Joined:
    May 7, 2014
    Posts:
    584
    I meant sprint.
     
  15. opsive

    opsive

    Joined:
    Mar 15, 2010
    Posts:
    4,866
    If you always want the character to sprint it can be handled the same way - just have your sprinting animation play when the forward input parameter of the movement blend tree is one.
     
    Gametyme likes this.
  16. Gametyme

    Gametyme

    Joined:
    May 7, 2014
    Posts:
    584
  17. Menn007

    Menn007

    Joined:
    Sep 20, 2015
    Posts:
    23
    Yes the latest Playmaker integration seem to fix the issue. I als noticed you included the Damage action posted on your forum... nice :)
     
  18. julianr

    julianr

    Joined:
    Jun 5, 2014
    Posts:
    1,162
    Hi ...

    With the Inventory Pro integration I have two problems; When equipping the Rocket Launcher that goes into the weapon inventory slot of the character inventory, then I equip/consume 4 rockets it goes into the ammo alot of the character inventory. If I drag the rockets back to the main inventory it applies the maximum value that the rocket launcher takes (6) instead of applying the amount not used (4).

    The other issue is when I split the rockets into two sets of 2. I then equip the 2 rockets to the character inventory, and drag those 2 back to the main inventory which changes the amount to 6, plus the 2 already in the main inventory increases the amount to 8. Same applies when you equip the rocket launcher and group of 4 rockets, then fire 1 rocket, leaving 3 rockets.. drag the rockets back into the main inventory and then equip them again will give you 5 rockets. Fixing the first issue would resolve the second I am sure.

    I've contacted the developer of Inventory Pro also in case the problem is not with the bridge. I've not had time to look at the code yet, but you may have a quick fix.
     
    Last edited: Mar 30, 2016
  19. opsive

    opsive

    Joined:
    Mar 15, 2010
    Posts:
    4,866
    I was able to reproduce what you are seeing. I'm interested in hearing what the Inventory Pro dev has to say - it looks like from the Third Person Controller side of things it is equipping and unequipping the correct amount:

    These callbacks are what the ConsumableTPCItem class sees when you go from Character -> Inventory -> Character. That's not to say that it the 6 isn't caused by the Third Person Controller, it's just that I don't know the inner workings of Inventory Pro enough to be able to say. You can point the Inventory Pro dev to this post for more information on what I'm seeing. I can also work with him to figure out what is really going on.
     
    julianr likes this.
  20. julianr

    julianr

    Joined:
    Jun 5, 2014
    Posts:
    1,162
    Thanks Justin. Much appreciated.
     
  21. atmosfearteam

    atmosfearteam

    Joined:
    Nov 10, 2015
    Posts:
    42
    @opsive Hello. We just recently purchased the Third Person Controller asset. It seems really great! But we had a question...

    How would we go about integrating a third-party network solution like Forge? The examples included with the Third Person Controller asset cover the built-in Unity networking, but not much else. We just wanted to know what things specifically we might need to sync in order to get something like Forge working.

    We understand that you probably don't have time to help with things related to other assets, but any sort of direction or tips would be very helpful.

    Thank you for any help you can provide! :)
     
  22. opsive

    opsive

    Joined:
    Mar 15, 2010
    Posts:
    4,866
    Thanks for your purchase! Unfortunately I haven't used Forge before so I can only go off of what I know with UNET. Any of the methods that are marked with the [ClientRPC] or [Command] attributes are important methods to synchronize. Any fields marked with the [SyncVar] are fields which are important to synchronize.
     
  23. julianr

    julianr

    Joined:
    Jun 5, 2014
    Posts:
    1,162
    Spoke to Jorisshh - he's working on it, and will no doubt contact you at some point.
     
  24. opsive

    opsive

    Joined:
    Mar 15, 2010
    Posts:
    4,866
    Sounds good. There's also a new Inventory Pro update on the Integrations page which adds compatibility with the latest Inventory Pro version. The same issue that you found earlier still exists, though.
     
    julianr likes this.
  25. drewradley

    drewradley

    Joined:
    Sep 22, 2010
    Posts:
    3,063
    I'm still getting horrible, horrible bouncing when I hit a mesh collider. Sometimes it flings the player right out of the scene. Could this be a hardware issue that gets "baked" in to the build?
     
  26. opsive

    opsive

    Joined:
    Mar 15, 2010
    Posts:
    4,866
    Can you send me a PM with a scene which has this bouncing behavior?
     
  27. atmosfearteam

    atmosfearteam

    Joined:
    Nov 10, 2015
    Posts:
    42
    @opsive Thanks for your previous message. That does help. It gives me something to look for. Thanks!

    I had one other question...

    I noticed in the demo scene (even in the demo webplayer on the opsive site) that whenever you are moving and then come to a stop it looks like the feet kinda shimmy around a little bit as it transitions into the idle state. I was wondering if there was any way to prevent this, or at least lessen it? Here is a clip to show what I mean:

    https://www.dropbox.com/s/jqyylrvyv5fx1bw/tpc-issue.mp4

    Thanks for all your help!
     
  28. opsive

    opsive

    Joined:
    Mar 15, 2010
    Posts:
    4,866
    That looks like it is caused by the Movement blend tree slowly changing between states. You can increase this speed by decreasing the Horizontal/Forward Input Damp Time on the AnimatorMonitor.
     
  29. drewradley

    drewradley

    Joined:
    Sep 22, 2010
    Posts:
    3,063
    I'll set up a new project and send it to you - my current project is huge - but we've done all this and you couldn't replicate the issue so that makes me wonder if it could be hardware based. It's frustrating the hell out of me right now.
     
  30. opsive

    opsive

    Joined:
    Mar 15, 2010
    Posts:
    4,866
    Since the controller uses Unity's physics it could be something dealing with that. I'll take another look at it and try to reproduce it. Also if you can include your Unity version then that should help narrow it down.
     
  31. drewradley

    drewradley

    Joined:
    Sep 22, 2010
    Posts:
    3,063
    I made a new project with nothing but the controller in it. Then I took one of the rifles (the orange one) and put a mesh collider on it, scaled it up and put it in the clean scene and "Dom" bounces off it. It's not nearly as bad as my current project where it happens almost every single time. It just seems to randomly happen. I can never do it on purpose, but if I keep running into over and over for a few seconds, it bounces off it. Sometimes it's barely noticeable and other times, it flings it halfway across the scene. I'm going to move it to my other computer and try it on that one and see if it still happens.
     
  32. opsive

    opsive

    Joined:
    Mar 15, 2010
    Posts:
    4,866
    Is it that the rifle's MeshCollider is intersecting with the character's CapsuleCollider? If the two colliders are intersecting then the physics will definitely go crazy.
     
  33. drewradley

    drewradley

    Joined:
    Sep 22, 2010
    Posts:
    3,063
    That's what it looks like, but I can't tell for sure. What would be the best way to debug that?
     
  34. opsive

    opsive

    Joined:
    Mar 15, 2010
    Posts:
    4,866
    Try removing the MeshCollider completely and see if it stops. If it does then that's the cause and can use Physics.IgnoreCollision to prevent the collision with the character.
     
  35. drewradley

    drewradley

    Joined:
    Sep 22, 2010
    Posts:
    3,063
    Oh, I know for a fact it's the mesh collider. If I change it to a box collider, or if the mesh collider is fairly smooth, it doesn't happen. I use box, etc colliders for everything I can, but some things I just can't do that with, like stairs or odd shaped geometry. For instance, I have an interior that is a complete set that has radiator heaters built in, I have to go to each one and put a box collider over the mesh collider to stop it from happening but the rails on the stairs needs to use a mesh collider or lots and lots of capsule colliders and I keep bouncing off it through the walls. But it would take too long to do that for every piece of geometry that has an uneven surface.
     
  36. opsive

    opsive

    Joined:
    Mar 15, 2010
    Posts:
    4,866
    Oh I thought that an item's mesh was causing the problem, not a mesh from the scene. In that case a PM with a repro project would be great, along with your Unity version
     
  37. drewradley

    drewradley

    Joined:
    Sep 22, 2010
    Posts:
    3,063
    It's any mesh collider that is uneven but in most cases I can get away with using a box collider or capsule. That was just an example of when I can't do that. It happens in 5.3.2f1 but I have not been able to replicate it in Unity 4.6.9f1. Perhaps I'll just go back to that. I've had no end of issues with 5 anyway but it looks so pretty!
     
  38. opsive

    opsive

    Joined:
    Mar 15, 2010
    Posts:
    4,866
    We're dropping Unity 4.6 support with the next update so I'd like to figure out what's causing the issue. If it's a Unity 5 bug I'll be able to minimize it into a small repro scene for them to take a look at.
     
  39. drewradley

    drewradley

    Joined:
    Sep 22, 2010
    Posts:
    3,063
    I guess that includes 4.7 as well... I'm currently upgrading both 4 and 5 to the latest versions as well as trying a fresh project on a different computer. I moved the new project over to my other computer and it still happened but I'm trying to make it from scratch on the other computer. I'm uploading the "bad" one to my cloud drive and will send you a link when it's done.
    edit: PM with link sent.
     
    Last edited: Mar 31, 2016
  40. magique

    magique

    Joined:
    May 2, 2014
    Posts:
    3,841
    This is a great tutorial and surprisingly simple to do. Thanks for making this.
     
    redjon29 and RoyalAllen like this.
  41. opsive

    opsive

    Joined:
    Mar 15, 2010
    Posts:
    4,866
    This does look like a Unity 5 bug unfortunately. I am able to reproduce it with a minimal project. I'll submit a bug report but I am able to get a Rigidbody capsule to teleport off of the weapon by just moving forward. In this project I'm not using any Third Person Controller components at all. I started testing with Unity 5.3.2 but it still exists in the latest Unity 5.4 beta.
     
  42. drewradley

    drewradley

    Joined:
    Sep 22, 2010
    Posts:
    3,063
    At least I know my nice new computer isn't the issue. I even Googled "unity 5 bounce off mesh collider" to no avail. Anyway, thanks for checking into it for me.
     
  43. atmosfearteam

    atmosfearteam

    Joined:
    Nov 10, 2015
    Posts:
    42
    @opsive That seems to do the trick. Thanks a lot! :)

    Just had another question. :p

    I noticed in one of the previous pages of this topic that someone requested integration with the MCS Morph3D characters. I was wondering if anything has come of this yet? I'm using that character and running into issues getting it to work. Basically, I opened the clean demo scene (the one from the Third Person Controller) and dropped a copy of the MCS Male prefab into it. Then I went through the Character Builder wizard to set it up. I then unchecked the box for the Dom character so it would be disabled, and changed the "Third Person Character" value in the Demo gameobject to my MCS character. I also copied over all the values from the Dom characters components to the MCS one just so everything was the same. When I try to play the scene I get all kinds of errors like Null Reference Exceptions related to many of the abilities. If I remove most of the abilities so only a couple like Jump and Height Change are left I can get the scene to actually load and the character does move around. But if I try to do anything other than simply walk I get errors. Like if I try to jump I get like KeyNotFoundException errors and stuff.

    So yeah, was just wondering if there was any method of making the MCS characters work yet or if there is anything I can jimmy around to make it work.

    Thanks for your help! :)
     
  44. redjon29

    redjon29

    Joined:
    Jul 12, 2015
    Posts:
    92
    Hi Justin we spoke about adding different generic abilities in the behavior designer integration, will it come with 1.3 update?
     
  45. opsive

    opsive

    Joined:
    Mar 15, 2010
    Posts:
    4,866
    There's a bug in MCS which will throw a null reference with the Character Builder. Take a look at this post for a workaround.
     
  46. opsive

    opsive

    Joined:
    Mar 15, 2010
    Posts:
    4,866
    I do not want to say anything definitively because I haven't figured out how I am going to do it yet but I do have it on my list for 1.3.
     
    redjon29 likes this.
  47. atmosfearteam

    atmosfearteam

    Joined:
    Nov 10, 2015
    Posts:
    42
    @opsive Thanks for the reply. Unfortunately that does not seem to help. I removed the component they mentioned in that post but I still get tons of NullReferenceExceptions related to the abilities when trying to play the scene. This is the error:

    Code (CSharp):
    1. NullReferenceException: Object reference not set to an instance of an object
    2. Opsive.ThirdPersonController.Abilities.ShortClimb.CanStartAbility () (at Assets/Third Person Controller/Scripts/Character/Abilities/ShortClimb.cs:69)
    3. Opsive.ThirdPersonController.Abilities.Ability.UpdateAbility () (at Assets/Third Person Controller/Scripts/Character/Abilities/Ability.cs:111)
    4. Opsive.ThirdPersonController.RigidbodyCharacterController.Move (Single horizontalMovement, Single forwardMovement, Quaternion lookRotation) (at Assets/Third Person Controller/Scripts/Character/RigidbodyCharacterController.cs:354)
    5. Opsive.ThirdPersonController.ControllerHandler.FixedUpdate () (at Assets/Third Person Controller/Scripts/Character/ControllerHandler.cs:284)
    If I remove that ability then when I try to play I get the same error but for another ability, and so on and so forth until I get down to just 1 or 2 abilities left. At that point the character will then at least move for me, but then other things don't work as I said in my previous post. I'm really confused lol.

    Thanks for all the help. :)
     
  48. opsive

    opsive

    Joined:
    Mar 15, 2010
    Posts:
    4,866
    If you set a breakpoint on that line is m_CapsuleCollider null? It almost looks like the Character Builder still didn't complete successfully.
     
  49. atmosfearteam

    atmosfearteam

    Joined:
    Nov 10, 2015
    Posts:
    42
    @opsive Yeah, looks like it is null...
     
  50. opsive

    opsive

    Joined:
    Mar 15, 2010
    Posts:
    4,866
    Did the Character Builder complete successfully without errors? It doesn't sound like the CapsuleCollider was added so it probably finished with an error. Can you post the Character Builder error?
     
Thread Status:
Not open for further replies.
unityunity