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

    impi2

    Joined:
    Jul 3, 2015
    Posts:
    43
    Thanks for taking a look.

    Yes i guess the two inventory clash and make it tricky. I suppose tpc selector might replace US hotbar or something.

    BTW... there was an update released today to 0.14, so not sure what that means for the 0.20 version.
     
  2. Alvarezmd90

    Alvarezmd90

    Joined:
    Jul 21, 2016
    Posts:
    151
    I requested the source code, since I want full control over opsive third person controller.
    Send you a mail about it.
     
  3. opsive

    opsive

    Joined:
    Mar 15, 2010
    Posts:
    5,127
    This page has steps on how to download it:

    http://opsive.com/assets/ThirdPersonController/documentation.php?id=50

    The camera controller can only target the object that it is anchored to so for that you'll want to disable the CameraController and CameraHandler and then use your
     
  4. GameNative

    GameNative

    Joined:
    Apr 17, 2014
    Posts:
    40
    Having an issue when using the Unity Network Lobby Example.

    The lobby works fine and loads the Network example scene and spawns the 3rd Person Controller character. Everything works fine except: the part in the code where it attempts to load the Default Items for inventory.

    Stepping through the code, it never assigns the inventory items with a quantity. Not sure why, it seems like it may be due to a timing issue when it attempts to load the items?

    If I set the Global flags for unlimited ammo, it works. But any attempt to load the default items does not work when using the Lobby example.
     
  5. opsive

    opsive

    Joined:
    Mar 15, 2010
    Posts:
    5,127
    Are you calling the OnNetworkAddFirstPlayer event? This thread has a conversation about switching over to the lobby example:

    http://opsive.com/forum/index.php/topic,4969.msg25768.html#msg25768
     
  6. GameNative

    GameNative

    Joined:
    Apr 17, 2014
    Posts:
    40
    I did add that event, however I did it on the scene load.
    Which fixed the issue with the demo box spawn script.
     
  7. GameNative

    GameNative

    Joined:
    Apr 17, 2014
    Posts:
    40
  8. opsive

    opsive

    Joined:
    Mar 15, 2010
    Posts:
    5,127
    Which method never gets called? Inventory.Initialize will call LoadDefaultLoadout unless the character is a remote player, in which case the MSG_PICKUP_ITEM method (NetworkPickupItem) gets called on the client and that will load all of the items.
     
  9. GameNative

    GameNative

    Joined:
    Apr 17, 2014
    Posts:
    40
    I tried the default Network scene that comes with the example using the Lobby example and it seems to work fine.

    In my implementation I tried adding another item to the DefaultLoadout

    Now i'm getting the error:
    Unable to pickup item with id xxxxxxxxx: has it been added to an objec
     
  10. opsive

    opsive

    Joined:
    Mar 15, 2010
    Posts:
    5,127
    You'll get that error if you haven't created an item that is assigned to that ItemType. You'll want to follow this video with that ItemType:

    http://opsive.com/assets/ThirdPersonController/videos.php?id=4
     
  11. Vladimitrius

    Vladimitrius

    Joined:
    Apr 4, 2017
    Posts:
    4
    Replying some reviews you said that deleting Demo's folder would be ok, but its became so painfull to fix everything that I think its a issue. Could you help me? Everytime I try to apply on my working model (not Unity default) but without success. Could you give me help?
     
  12. opsive

    opsive

    Joined:
    Mar 15, 2010
    Posts:
    5,127
    What issues are you hitting? If you're just getting started I highly recommend that you import the demo folders as well. This will allow you to become more familiar with the controller structure and also contain all of the animations/models/textures/etc so you can hit the ground running. After you have a little bit of experience with the controller you can then delete the Demos folder as you would have replaced the art assets with your own.
     
  13. Vladimitrius

    Vladimitrius

    Joined:
    Apr 4, 2017
    Posts:
    4
    Thks for the support. I think it the character maker should have a basic Anim, controller set outside Demo's folder.
    Actually i think would be great that all basic stuff (animator, animations - the model i think should be provided by the player) should be organized inside specific folders outside demo´s.

    I know how get the things working, althought my post is about try to improve the experience of medium level or < users.

    thx once more!
     
    opsive likes this.
  14. aidesigner

    aidesigner

    Joined:
    May 2, 2012
    Posts:
    121
    Tried TPC with my character and used the character builder to set mode to RPG. My first character walks forward, but cannot move horizontal (I ran the TPC input setup). Finally I went to the TPC code, which seemed to say a character cannot move left/right unless firing. This makes no sense - is this a bug?

    On a side note this code wrapper stuff really adds to complexity (i.e. navigate to source). I am a asset store publisher of useful Unity utilities and my products have both Source/DLLs. I then use a processor define along with adjusting DLL importers to switch back and forth in a editor script. This would have made this debug much smoother. Not sure how security is a factor since users can always get the code via your download anyway.

    ControllerHandler.cs (snippet):
    Code (CSharp):
    1. else if (m_Controller.Movement == RigidbodyCharacterController.MovementType.RPG) {
    2.   if (m_PlayerInput.GetButton(Constants.SecondaryDisableButtonName) && m_PlayerInput.GetButton(Constants.PrimaryDisableButtonName)) {
    3.      m_ForwardMovement = 1;
    4.    } else if (!m_PlayerInput.GetButton(Constants.PrimaryDisableButtonName)) {
    5.      // ********** This is happening because fire1 is not pressed, and character cannot move left/right ********
    6.      m_HorizontalMovement = 0;
    7.    }
    8. }
     
    Last edited: Sep 26, 2017
  15. opsive

    opsive

    Joined:
    Mar 15, 2010
    Posts:
    5,127
    The RPG movement type is based off of more RPG games such as wow where in order to rotate you have to hold the right mouse button down. It sounds like you'll want to use the combat or adventure movement type where there is more horizontal movement.
     
  16. rafaelmfernandez

    rafaelmfernandez

    Joined:
    Aug 11, 2013
    Posts:
    62
    Hello,

    Loving your Third Person Controller as we are using it in our game right now. I had a question about a very annoying and weird bug we are experiencing. We have almost no clue what is causing it, or how to fix it but basically there are moments where your character cannot walk in a specific direction whatsoever and a few times I have had it where movement in all directions is locked. It seems to happen mostly when a collider is put inside of the characters capsule collider. However I am not sure if that is the cause or anything but that is my theory. Have you had any other reports of an issue like this?

    Here is a video where it happens in the first few seconds when the player exits the truck. Youll see just before I despawn the character that I am trying to move him back towards the truck but am unable to so I am forced to respawn my character.



    Any help would be immense. Thank you!
     
    mwituni likes this.
  17. aidesigner

    aidesigner

    Joined:
    May 2, 2012
    Posts:
    121
    I ran the clean scene from TPC demo. I hit enter a couple of times until I got to RPG. In RPG the character moved in all directions (no right mouse needed) and the camera/character both rotate (Exactly what I want and different from adventure/combat). Note in clean sence RPG character/camera both rotate if moving while hit left/right, but only camera rotates if not moving while hit left/right (Again what I want). So basically I would like clean scene RPG camera/character behavior exactly.

    Now I build an RPG character and none of this happens. I noticed the clean scene demo has a View Mode dropdown under the camera states, but I am missing this options (Please explain - image below?). I added the ThirdPerson (CameraState) hopping the CameraControllerInspector would magically make these inspector properties show up (No luck).

    Can you please help me get all the behavior from RPG clean scene?

    I am missing View Mode from image below (I have states default/Zoom/ThirdPerson):

    upload_2017-9-26_13-21-1.png

    Guess this is part of why the camera can rotate in RPG:
    Code (CSharp):
    1.                 // In most cases the character follows the camera. However, with the RPG view mode there are times when the camera should instead follow the character.
    2.                 if (m_ActiveState.ViewMode == CameraMonitor.CameraViewMode.RPG && m_CameraHandler.RotateBehindCharacter) {
    3.  
     
    Last edited: Sep 26, 2017
  18. opsive

    opsive

    Joined:
    Mar 15, 2010
    Posts:
    5,127
    Glad you're enjoying the controller! What type of collider are you placing inside the collider? This could cause the rigidbody to behave oddly. If you don't want it to cause collisions you could try placing the object on the VisualEffect or CharacterCollider layer - this will prevent the capsule collider from running a collision check against it.
     
  19. opsive

    opsive

    Joined:
    Mar 15, 2010
    Posts:
    5,127
    That would definitely cause it. For the RPG movement type especially it works with the camera in order to achieve the functionality from the clean scene.

    What you'll want to do is change your Default camera state to the RPG View Type. Once you do this you should have a similar functionality as the clean scene. You don't want to bring over all of the states that the clean scene's camera uses since that contains extra view types such as top down or 2.5D.
     
  20. rafaelmfernandez

    rafaelmfernandez

    Joined:
    Aug 11, 2013
    Posts:
    62
    We managed to either fix it or dramatically reduce its occurrence by commenting out line 443:
    Code (CSharp):
    1.             // Ensures the current movement is valid.
    2.             //CheckMovement();
    Seems to have fixed our issue.
     
  21. aidesigner

    aidesigner

    Joined:
    May 2, 2012
    Posts:
    121
    No luck it still acts like a FPS and camera is not rotating. I followed your instruction (See image). Do you set Default camera state by having it highlighted as shown?

    upload_2017-9-26_14-16-14.png
     
  22. opsive

    opsive

    Joined:
    Mar 15, 2010
    Posts:
    5,127
    Are you running the latest version of the controller? There used to be a check in there which could cause the behavior that you are experiencing. If you are running the latest which block within CheckMovement is preventing the character from moving?
     
  23. opsive

    opsive

    Joined:
    Mar 15, 2010
    Posts:
    5,127
    It looks like you are close - you'll want to remove the RPG state completely. The Default state should then have its View Mode set to RPG. Right now your RPG state has a View Mode of Third Person which is going to cause problems. Here's a bit more info on the state system:

    http://opsive.com/assets/ThirdPersonController/documentation.php?id=127
     
  24. aidesigner

    aidesigner

    Joined:
    May 2, 2012
    Posts:
    121
    Almost there, what do I have to change so that left/right just rotates just camera when not moving forward/backward? This is a nice feature I see in clean scene RPG that enables you to see the face of your character. When you move the camera once again rotates behind character.
     
  25. opsive

    opsive

    Joined:
    Mar 15, 2010
    Posts:
    5,127
    As long as you have the Camera Controller's ViewType set to RPG and the RigidbodyCharacterController's MovementType set to RPG you should have that functionality. Double check that when you enter play mode the ViewType is RPG on the CameraController (this will indicate whether or not the correct state is running)
     
  26. aidesigner

    aidesigner

    Joined:
    May 2, 2012
    Posts:
    121
    Yes I confirmed everything is correct in playmode. The camera and character are rotating and I wonder if this is actually the correct behavior. It just happens that your clean scene RPG rotates only the camera (360deg around character) if you are not moving forward or backward. How can I get this behavior?

    Just for clarification are there any situations where the camera view mode and characters movement type should be different (i.e. Four legged/RPG)? Basically trying to figure out which pairings I can have as I may give the user options.
     
    Last edited: Sep 26, 2017
  27. opsive

    opsive

    Joined:
    Mar 15, 2010
    Posts:
    5,127
    Here a scene with just a RPG character with a RPG camera state:

    https://www.dropbox.com/s/o918wxs4gns7u8n/RPG.unitypackage?dl=0

    You should be able to compare your settings to this package.

    I haven't seen anybody use any other movement type with the RPG view type but pairing the Four Legged with the Top Down or 2.5D View Type makes sense.
     
  28. GameNative

    GameNative

    Joined:
    Apr 17, 2014
    Posts:
    40
    Same issue, found that it only re-creates the problem when using the source version of the code.
    When using the dll version it doesn't handle the pre-processor symbol define of : ENABLE_MULTIPLAYER

    When the symbol is present with the source version, multiplayer using the lobby doesn't work. Only in regards to inventory being loaded when you connect.
     
  29. opsive

    opsive

    Joined:
    Mar 15, 2010
    Posts:
    5,127
    That's correct, so for ENABLE_MULTIPLAYER you do want to use the source version.

    From this post it sounded like it worked, did something change since then? This post explains how to debug the inventory issue from before.
     
  30. GameNative

    GameNative

    Joined:
    Apr 17, 2014
    Posts:
    40
    That's correct, it never really worked since it was using the DLL version (failing on the symbol), it was just faulting on enable multi-player. When multi-player is truley enabled, it doesn't work with the lobby. (inventory only, everything else seems to work).

    If you download the lobby package and the source version of 3rd person controller, it's reproducible.
     
  31. opsive

    opsive

    Joined:
    Mar 15, 2010
    Posts:
    5,127
    It sounds like there may need to be an integration for the Lobby Example asset. Until I take a look at it this post explains how another user got it to work. If you can also provide the results from this post I can explain what should be happening.
     
  32. opsive

    opsive

    Joined:
    Mar 15, 2010
    Posts:
    5,127
    We will be at Unite Austin next week and if you're there as well make sure you stop by our booth to enter for a chance to win a copy of UFPS 2 or Third Person Controller 2!
     
    Last edited: Sep 29, 2017
  33. Pvt_Hudson

    Pvt_Hudson

    Joined:
    Jan 20, 2016
    Posts:
    41
    noob question: i'm playing with the demo scene...where/how do we invert the camera Y axis?

    thanks
     
  34. opsive

    opsive

    Joined:
    Mar 15, 2010
    Posts:
    5,127
    You can change that within the Unity Input Manager:

    https://docs.unity3d.com/Manual/class-InputManager.html

    There is an invert toggle that you can enable (for mouse y)
     
    Pvt_Hudson likes this.
  35. Piahouka

    Piahouka

    Joined:
    Sep 1, 2015
    Posts:
    40
    Hi, opsive.
    I want separate short climb animation by object height.
    I think if there is min climb height it is more easy to implement it,
    but my skill is poor so, I wonder how to Implement it.
     
  36. opsive

    opsive

    Joined:
    Mar 15, 2010
    Posts:
    5,127
    The existing short climb ability has two different modes for climbing from a standing position: short and tall. If the climbable object is taller then the character's capsule collider then it'll go into the Short Climb.Tall Climb state, otherwise it'll go into the Short Climb.Short Climb state. If you'd like more height animations then just those two it'll take some modification within the ShortClimb ability. GetDestinationState will have to return a different state name depending on the height that the character is climbing. You can use a similar structure as what the existing ability uses for detecting if the character is climbing over a tall object:

    Code (csharp):
    1.  
    2.             m_TallClimb = m_ClimbPosition.y > m_Transform.position.y + m_Controller.CapsuleCollider.height;
    3.  
    For example, if you want to add a mid animation then it would look something like:
    Code (csharp):
    1.  
    2.             m_MidClimb = m_ClimbPosition.y > m_Transform.position.y + m_Controller.CapsuleCollider.height / 2;
    3.  
    Where the mid animation is true if the object is greater than the character's height divided by two. Within GetDestinationState you'd then return:

    Code (csharp):
    1.  
    2.             if (m_TallClimb) {
    3.                 return "Short Climb.Tall Climb";
    4.             }
    5.             if (m_MidClimb) {
    6.                 return "Short Climb.Mid Climb";
    7.             }
    8.             return "Short Climb.Short Climb";
    9.  
    Take a look at this video for more details on how the abilities are setup:

    http://opsive.com/assets/ThirdPersonController/videos.php?id=7
     
    Last edited: Oct 19, 2017
    Piahouka likes this.
  37. jaelove

    jaelove

    Joined:
    Jul 5, 2012
    Posts:
    302
    is it possible to make a traditional 2.5d style beat em up with this kit?
     
  38. opsive

    opsive

    Joined:
    Mar 15, 2010
    Posts:
    5,127
    Thanks for taking a look at the Third Person Controller!

    The melee weapon system works with colliders so the only possible thing that that I could see happening is that with an extremely quick punch the physics system would miss the collision event. For version 2 I am planning on adding a way to detect collisions with raycasts in addition to the physics approach and after I add it then I'll see if it makes sense to backport to v1. Besides that the movement aspect would work well with the beat em up style.
     
    TeagansDad likes this.
  39. jaelove

    jaelove

    Joined:
    Jul 5, 2012
    Posts:
    302
    Thanks for the response. Any time table for version 2.0?
     
  40. opsive

    opsive

    Joined:
    Mar 15, 2010
    Posts:
    5,127
    Not soon enough :) It's looking like Q1 of next year. We have one more alpha left and then we'll begin the beta phase.
     
  41. RobsonFMaciel

    RobsonFMaciel

    Joined:
    Jan 12, 2013
    Posts:
    187
    Hi @opsive
    Is there any demo or some tutorial on how to implement multiplayer?
     
  42. opsive

    opsive

    Joined:
    Mar 15, 2010
    Posts:
    5,127
    RobsonFMaciel likes this.
  43. TonanBora

    TonanBora

    Joined:
    Feb 4, 2013
    Posts:
    493
    Feature Request:
    Have the Dodge ability give the option to use the currently equipped weapon as a prefix (like BaseLayer.Sword.Dodge), as some weapons have special dodge animations, and the ability to pick the layer(s) effected.
     
    Teila likes this.
  44. TeagansDad

    TeagansDad

    Joined:
    Nov 17, 2012
    Posts:
    957
    You can already do this. :)

    You can set it up in the Character Item Animations settings on the weapon. In "Default States" you can add the "Dodge" ability and then set the layers you want to use there. Then you set up your animator states following the usual convention for abilities ("Sword" -> "Sword Dodge")

    I've done this before (using one of Kubold's pakcs), but it's been a while. I did get it working properly though.
     
    TonanBora, Teila and opsive like this.
  45. TonanBora

    TonanBora

    Joined:
    Feb 4, 2013
    Posts:
    493
    Ah, THAT'S what that is for! :p
    Thanks. :)
     
  46. TonanBora

    TonanBora

    Joined:
    Feb 4, 2013
    Posts:
    493
    So, I have another issue:


    For some reason, the Movement Attack is getting triggered whenever I click and THEN move, in addition to when I am moving and then click. In addition, if I am in the middle of a move attack (attacking while trying to move in one direction) and stop moving, then an idle attack is triggered, and if I start moving, the move attack is re-triggered (and so on).

    How would I keep this from happening?
     
  47. opsive

    opsive

    Joined:
    Mar 15, 2010
    Posts:
    5,127
    Check the button mapping on your melee weapon - the input name should be something like Fire1 rather than vertical. If that doesn't solve it then you'll want to check your input manager to see what the button is mapped to that the melee weapon is using.
     
  48. TonanBora

    TonanBora

    Joined:
    Feb 4, 2013
    Posts:
    493
    Yup, they are.
    Input mix up is not the issue, as if it where, I would expect the character to attack EVERY time I move forward, which it does not. It attacks only after I press the left mouse button to initialize the attack.
    Sword Setup:
    2017-10-26_13-34-08.png

    All the Use States (for both Idle and Movement) are set to effect both the upper and base layers.
    The issue here, is that it keeps transitioning from Idle attacks, to Movement Attacks unless I allow the animation to play all the way through before pressing another key (or releasing it if I am in the movement state).
     
  49. opsive

    opsive

    Joined:
    Mar 15, 2010
    Posts:
    5,127
    The definitive way to determine why the weapon is being used is to place a breakpoint/Debug.Log statement within MeleeWeapon.TryUse. What is the callstack? This should help indicate what is calling it.
     
  50. TonanBora

    TonanBora

    Joined:
    Feb 4, 2013
    Posts:
    493
    Well, this is interesting, the TryUse function is only called once, but when I start pressing a movement key right after left clicking. I am sending you a link to the Unlisted video in a conversation, as it shows some of your code. :)
     
Thread Status:
Not open for further replies.