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

    devstudent14

    Joined:
    Feb 18, 2014
    Posts:
    133
    No sorry, I was referring to this video:


    I followed the steps but the camera is first person and I can't work out what to do to make a third person controller.
     
  2. devstudent14

    devstudent14

    Joined:
    Feb 18, 2014
    Posts:
    133
    Ah, sorry again. I went back and I think I missed the 'update input manager' step. Works now :)
     
  3. Twoonebe

    Twoonebe

    Joined:
    Mar 30, 2013
    Posts:
    174
    i have no information about footstep system are they include with the asset ?
     
  4. opsive

    opsive

    Joined:
    Mar 15, 2010
    Posts:
    5,125
    Yes, there is a footstep system. It uses a trigger which can then play a footstep sound. It currently does not support per-tag or material sounds but I will be integrating the UFPS Surface System in version 2 and that is an extremely powerful system which will allow for this.
     
  5. nproject

    nproject

    Joined:
    Jan 16, 2015
    Posts:
    68
    'UnityEngine.Types.GetType(string, string)' is obsolete: "This was an internal method which is no longer used" in CharacterBuilder.cs(165,45)
    Anyone else experience this before?
     
  6. opsive

    opsive

    Joined:
    Mar 15, 2010
    Posts:
    5,125
    That's related to MCS, correct? Take a look at this post: http://opsive.com/forum/index.php/topic,3698.0.html
     
  7. nproject

    nproject

    Joined:
    Jan 16, 2015
    Posts:
    68
  8. Deleted User

    Deleted User

    Guest

    Does TPC has "DestroyIt" asset integration? Would like to use that in my projects and need to know if it will work. Will it also work in multiplayer?

    And is there a First Person camera script for TPC? I know UFPS is for FPS but I just need a First Person camera option for TPC in my current project for now.
     
  9. opsive

    opsive

    Joined:
    Mar 15, 2010
    Posts:
    5,125
    It doesn't, but I think that it would be pretty easy to add integration with damage events. This would act as the bridge between Third Person Controller and DestroyIt. In terms of multiplayer support, the damage event works on the Third Person Controller side but DestroyIt would also need multiplayer support in order for it to fully work.

    A community member created a first person mod but there isn't official first person support until the UFPS integration.
     
    Deleted User likes this.
  10. erich202

    erich202

    Joined:
    Sep 24, 2016
    Posts:
    38
    Hey guys!

    Does anybody know how to do any of this? Perhaps it's in a guide video or the docs? I've looked but no luck yet

    1. Allow player to rotate camera (around Y axis) in Top Down or Point Click view.
    2. Change the camera distance away from the character.

    I don't see it in the CameraController options, but also I noticed changing any of those options doesn't seem to do anything. I feel like I'm missing something obvious about customizing the camera.

    upload_2017-1-4_17-20-11.png

    Thanks in advance,
    Eric
     
  11. opsive

    opsive

    Joined:
    Mar 15, 2010
    Posts:
    5,125
    The top down/point click camera type doesn't allow for player-controlled rotation around the character. I'm actually working on the camera controller aspect right now and can look at adding it.

    You'll want to change the Default state to the Top Down View Type and then under that you can change the view distance under the "Apply View" setting.
     
  12. StephanTTM

    StephanTTM

    Joined:
    Jul 14, 2016
    Posts:
    1
    I'm using a MCS model with this asset and when I run my game the character opens his mouth and wont close it, I don't know where to look for whatever it could be. I have already checked all the blend shapes and it's not from them.
     
  13. hopeful

    hopeful

    Joined:
    Nov 20, 2013
    Posts:
    5,682
    The default setting for mecanim is jaw open. So this is a behavior you'll find with all characters who have jaw bones.
     
    TeagansDad and opsive like this.
  14. Duffer123

    Duffer123

    Joined:
    May 24, 2015
    Posts:
    1,215
    Could you create an Rpg with just Playmaker, Inventory Pro and this asset? (Asssuming models, terrain, environment taken care of). Would you need anything else, assuming you were a poor coder? Behaviour Designer? Question for this forum...
     
  15. pushingpandas

    pushingpandas

    Joined:
    Jan 12, 2013
    Posts:
    1,419
    I like your asset features but why is the movement and handling so blocked.. its not fluid like usually in game . Littlebit laggy if you know what I mean. I am on osx could that be the issue?
     
  16. opsive

    opsive

    Joined:
    Mar 15, 2010
    Posts:
    5,125
    Playmaker, Behavior Designer, and Inventory Pro will definitely allow you to have a great building block, but RPGs are one of the more complicated assets so no matter which asset you buy it'll most likely take some coding. Assets will definitely help, but they are by no means a complete game and it'll take your own customization in order to finish the project.
     
    TeagansDad likes this.
  17. opsive

    opsive

    Joined:
    Mar 15, 2010
    Posts:
    5,125
    Animations are one of the weakest aspects of the Third Person Controller (and we are working on it). The good news is that you can replace the animator controller with your own animations while still using the complete functionality of the Third Person Controller. This page has some more info on replacing your animations: http://www.opsive.com/assets/ThirdPersonController/documentation.php?id=111
     
  18. Duffer123

    Duffer123

    Joined:
    May 24, 2015
    Posts:
    1,215
    @opsive ,
    Thank you for such a candid response. I can code to an extent and, tbh, would prefer to make use of my own scriptable objects for a lot of it. Ive got some rpg kits and can make rpgs with them but i can find the kits too prescriptive or restrictive for what i want...
     
  19. opsive

    opsive

    Joined:
    Mar 15, 2010
    Posts:
    5,125
    In that case you should be set - while the Third Person Controller does include components which can control the inventory, camera, ik, etc, you can just not use that component if you'd rather use your own component or a more specialized component in that area.
     
  20. Spacewalker

    Spacewalker

    Joined:
    Nov 28, 2016
    Posts:
    12
    Hello, I noticed a bug's with the weapons "Shootable Weapon". If in settings "Fire Options" select "Fire mode" -> "Full Auto", and then in the game shoot the last bullets and keep pressing the fire, then the animation of the character will jam and the last two shells will not disappear. And I have a problem with the script "Respawner", it does not work without "Object Spawner" in Multiplayer. All anything, but if you connect an example "Network Lobby", the script "Object Spawner" is also not working. This can be corrected?
     

    Attached Files:

  21. opsive

    opsive

    Joined:
    Mar 15, 2010
    Posts:
    5,125
    I just tried it with the assault rifle but the animations played and the last two shells disappeared. I do think that it was because of a fix that I made within ShootableWeapon earlier though. Within EmptyClip change:

    Code (csharp):
    1.  
    2.   if (m_EmptyClipEvent != null) {
    3.    return;
    4.   }
    5.  
    to:
    Code (csharp):
    1.  
    2.   if (m_EmptyClipEvent != null) {
    3.   Scheduler.Cancel(ref m_EmptyClipEvent);
    4.   }
    5.  
    And also add the following to marked in comments to StopFiring:

    Code (csharp):
    1.  
    2.   if (!m_IsFiring) {
    3.   EventHandler.ExecuteEvent(m_Character, "OnItemStopUse"); // <----------- here
    4.   return;
    5.   }
    6.  
    The Object Spawner component is provided as part of a demo for the network scene and in your project you'd have your own logic which handles the spawning of objects within the scene. The Respawner component doesn't require the Object Spawner, but the Object Spawner does spawn the objects on the network so it does require the network to be aware of the object.
     
  22. Spacewalker

    Spacewalker

    Joined:
    Nov 28, 2016
    Posts:
    12
    Thank you very much. It helped, now there is no bug when shooting. The truth is sometimes remains one Shell (Clone) in the scene from the last clips. There is another option that is not working as I would like. In "Shootable Weapon" parameter "Recoil Amount" does not move the camera during the recoil. It can be fixed?
     

    Attached Files:

    • Bug.jpg
      Bug.jpg
      File size:
      311.1 KB
      Views:
      894
  23. opsive

    opsive

    Joined:
    Mar 15, 2010
    Posts:
    5,125
    Are you able to reproduce this consistently? is it only when you completely empty the clip? How much ammo does your assault rifle have?

    Take a look at this post:

    http://opsive.com/forum/index.php/topic,3798.0.html
     
  24. Spacewalker

    Spacewalker

    Joined:
    Nov 28, 2016
    Posts:
    12
    Thank you so much. Recoil is now working. But that would be a crosshair to come to the point hit: m_Pitch -= m_Recoil * (Mathf.Rad2Deg / 10), or m_Pitch -= m_Recoil * 5.7f. It's closer to the value Vector3.Angle (m_FirePoint.forward before, m_FirePoint.forward after).
    Regarding the Shell (Clone), I created a new project, set the Third Person Controller, replaced the folder Scripts as shown in the instructions: http://opsive.com/assets/ThirdPersonController/documentation.php?id=50. Then I turned on the demo Third Person Shooter (or Clean scene no difference). I shoot all the bullets from the AssaultRifle to the last three (or other values no difference), then clamped Fire until empty clicks. On the scene stays one Shell (Clone), which does not disappear. Maybe it's just me ¯ \ _ (ツ) _ / ¯.
     

    Attached Files:

  25. TeagansDad

    TeagansDad

    Joined:
    Nov 17, 2012
    Posts:
    957
    You can quite easily swap out the included animations for those in Kubold's Movement Animset Pro and instantly get much more fluid movement. At least for the basic movement; motions like climbing, jumping, etc require somewhat more work to swap out the animations. The Sword Animset Pro animations replace the animations in the Sword state quite nicely too.

    But those animation packs each cost about as much as TPC itself; the included animations aren't really intended to be used in a game -- they're placeholders and demo material (Justin can correct me if I'm wrong on this).
     
    opsive likes this.
  26. opsive

    opsive

    Joined:
    Mar 15, 2010
    Posts:
    5,125
    Ahh, got it! The scheduled events are pooled and the assault rifle was cancelling a pooled even that it no longer had ownership of. Open ShootableWeapon.cs and add the following to the top of DoFire:

    Code (csharp):
    1.  
    2.   m_ReadyToFire = false;
    3.   m_FireEvent = null; // <----- new
    4.  
     
  27. Spacewalker

    Spacewalker

    Joined:
    Nov 28, 2016
    Posts:
    12
    Thank you very much, now everything works as it should. But there are problems in multiplayer. For example, if you include the demo scene Network and change camera settings "Camera offset", then bullets players fly not there. It is even possible to notice without changing camera settings.
    Also recoil is not working for other players in multiplayer.
     

    Attached Files:

  28. opsive

    opsive

    Joined:
    Mar 15, 2010
    Posts:
    5,125
    I just tried it and wasn't able to reproduce the firing not going in the correct direction. Are you referring to the client character within the server game instance or the server character within the client game instance? I used your more extreme offset of (1, 1.5, -4)
     
  29. Spacewalker

    Spacewalker

    Joined:
    Nov 28, 2016
    Posts:
    12
    I mean the client only. Example: if you open the demo scene "Network", change in the character of "Network Doug" for "Pistol" -> "Accuracy Loss Percent" (Figure Bug_1) and change the value of the camera "Camera Offset" (Figure Bug_2). Then build the project, open, go to "LAN Host" - it well works (Figure Bug_3). Then open to "LAN Client" - shoot, crosshair does not move, bullets fly further to the right (Figure Bug_4).
     

    Attached Files:

  30. opsive

    opsive

    Joined:
    Mar 15, 2010
    Posts:
    5,125
    I still haven't reproduced the problem of the client firing in the wrong direction but I did fix the recoil problem. The issue related to when the shared properties were initialized relative to the network initialization. Open Item.cs and add the following new method:

    Code (csharp):
    1.  
    2.   /// </summary>
    3.   private void Start()
    4.   {
    5.   // Independent look characters do not need to communicate with the camera. Do not initialze the SharedFields on the network to prevent non-local characters from
    6.   // using the main camera to determine their look direction. The SharedFields have been implemented by the NetworkMonitor component.
    7. #if ENABLE_MULTIPLAYER
    8.   if (!m_IndependentLook.Invoke() && m_IsLocalPlayer.Invoke()) {
    9. #else
    10.   if (!m_IndependentLook.Invoke()) {
    11. #endif
    12.   SharedManager.InitializeSharedFields(Utility.FindCamera(m_Character).gameObject, this);
    13.   }
    14.   }
    15.  
    You'll see that the logic within this method is currently within the Init method - go ahead and completely remove those lines.
     
  31. Spacewalker

    Spacewalker

    Joined:
    Nov 28, 2016
    Posts:
    12
    Thank you very much, crosshairs and recoil are now working at the client :)
    Unfortunately I have a client does not shoot in the crosshairs. I have included a check and change the settings of the camera (Figure Bug_0). Server shoots crosshairs (Figure Bug_1, Sometimes it looks crooked when viewed by another player o_O ). Client shoots towards weapons (Figure Bug_2, It shoots straight, but not in the crosshairs :( ). It turns out (Figure Bug_3).
    I do not seem to change anything, set the Third Person Controller of Asset Story in a new project and replaced script folder according to the instructions. It can be fixed?
     

    Attached Files:

  32. opsive

    opsive

    Joined:
    Mar 15, 2010
    Posts:
    5,125
    Hmm, I just tried it again and the character shot in the correct direction on the client. There is a random spread that occurs when the weapon is fired, could it be that? If you set the spread to 0 and it still does it can you contact me at support@opsive.com with a built executable so I can take a look?
     
  33. Spacewalker

    Spacewalker

    Joined:
    Nov 28, 2016
    Posts:
    12
    Hello, I have a spread equal to 0. I sent you an executable file, please see.
     
  34. Twoonebe

    Twoonebe

    Joined:
    Mar 30, 2013
    Posts:
    174
    When is version 2 available ? And what for features are included ?
     
  35. opsive

    opsive

    Joined:
    Mar 15, 2010
    Posts:
    5,125
    We do not have a release date yet but you can follow our progress on Twitter. The major features will be integration with UFPS and all that goes along with it, when we get closer I'll have a more defined set of features created as well.
     
  36. longroadhwy

    longroadhwy

    Joined:
    May 4, 2014
    Posts:
    1,551
    Are you going to be supporting UFPS2 on the same forums as UFPS (only on the opsive website) or are you planning a new support thread for UFPS2 on the unity forums?
     
  37. opsive

    opsive

    Joined:
    Mar 15, 2010
    Posts:
    5,125
    The UFPS and Opsive forums will be merged on the opsive site, and I'll probably create a new thread on the Unity forums as well.
     
  38. Porto881

    Porto881

    Joined:
    Jul 11, 2013
    Posts:
    74
    I have a problem with the camera, when the I start a scene the camera is in "first person" and I have to "look" to the left for the character to appear. When it has appeared everything works well. What might be the problem?
     
  39. opsive

    opsive

    Joined:
    Mar 15, 2010
    Posts:
    5,125
    It sounds like an offset problem on the camera state. Did you change the Default state at all? From a fresh project try following these two videos to get things started:

    http://www.opsive.com/assets/ThirdPersonController/videos.php?id=1
    http://www.opsive.com/assets/ThirdPersonController/videos.php?id=2
     
  40. mikezenox

    mikezenox

    Joined:
    Oct 18, 2012
    Posts:
    55
    Sorry if this has been asked before, but I'm having trouble configuring Abilities to my UMA Dynamic Avatar. All the abilities in the screenshot of my inspector here work correctly, except for the Crouch ability. When added to the RigidBodyController, as per the sample file downloaded via the integrations page, the HeightChange class is instantiated with the properties "State Prefix", "Idle State", and "Movement State" all as null. I can modify them through the inspector and then it works fine, but cannot find how to access these properties through script. Do I need to download the source code or create a custom ability class for this?
     

    Attached Files:

  41. opsive

    opsive

    Joined:
    Mar 15, 2010
    Posts:
    5,125
    The HeightChange ability doesn't have a public property for those fields so I recommend subclassing the ability and then adding the setter properties. This method is described more in detail here.
     
  42. JMyerscough

    JMyerscough

    Joined:
    Jul 12, 2012
    Posts:
    117
    Hey there,
    I'm a long-time UFPS user, but after trying out Third Person Controller, something about it feels a lot better. Some of the animations are clunky, but that can be replaced. Before buying, I'm wondering what the process of making it first person would be (besides attaching the camera to the head). I know it's not something that's supported, but would a lot of it be as simple as using animations similar to UFPS' in TPS? Or do you suggest I wait for UFPS2?
     
  43. opsive

    opsive

    Joined:
    Mar 15, 2010
    Posts:
    5,125
    Awesome - the animations are the weakest point but we are working on improving that for version 2. In fact we should have another animation test within a few days. You are right though in that you can just switch them out in the animator controller though.

    To answer your question, @RoyalAllen created a quick video showing how to get a first person view. It is mostly a matter of just changing the anchor position as well as the camera offsets. You do not need to replace any animations. A true first person view uses a second camera to render the weapons which this mod does not do. We are currently working on version 2 full time and most of the structure is in place. It's still many months away from release though since we want to ensure this version is as solid as it can be.
     
    Last edited: Jan 21, 2017
    TeagansDad likes this.
  44. Stevepunk

    Stevepunk

    Joined:
    Oct 20, 2013
    Posts:
    205
    I was referred to this asset by Devdog (creator of Inventory Pro).
    I was wondering how the inventory system in this asset compares to IP and how easy the integration is if IP is better?

    I'm in the process of prototyping a 2.5D platformer and I am currently using Corgi but the 3D animation support is lacking (though I do like Corgi's tight non-physics raycast-based controller) [and the fact that it uses 2D physics is a slight inconvenience as my character can move into the background/foreground at certain locations to swap layers - achieved by turning 2D collision layers on and off - it would be easier to use 3D, lock z-movement and only unlock at specific points].
    Is there any option in TPC to turn off physics?

    A common problem with platformers and physics is if the character is running up a slope they already have some upward momentum so if they jump by adding a force then their jump will be higher than normal; if they are running down a slope then the jump will be lower than normal; if they land on a corner there can be some unintended behavior as well as when interacting with other objects.

    You only need to look at other physics based games such as those by Bethesda for the strange things that can happen with a physics engine.

    The jumping problem can be fixed by setting an upward velocity instead of adding a force, but the other odd interactions remain. As you can imagine for any action/twitch game the controls need to be tight, responsive and consistent.

    How does TPC address these issues?
     
  45. opsive

    opsive

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

    The third person inventory works along the side of the Inventory Pro inventory. Inventory Pro will have more features since it is focused on the inventory aspect but you can use the two together to get the best of both worlds.

    The current version of the Third Person Controller uses a Rigidbody for its locomotion so you aren't able to get around that. This isn't the case now but for version 2 the Rigidbody is no longer required and all of the movement/collision detection is handled within our own character controller (and unfortunately version 2 is still many months away).

    The Third Person Controller can easily be extended with the ability system. In your case you could have an ability that is always active which takes control over and manages your own movements instead of having it be physics driven. In the case of the Jump ability it adds a force directly to the velocity instead of using Rigidbody.AddForce which should make that situation easier to handle.

    Does that help at all?
     
  46. Stevepunk

    Stevepunk

    Joined:
    Oct 20, 2013
    Posts:
    205
    Thanks for your response. It definitely points me in the right direction of how to approach this problem.

    Rigidbodies are ok as they are required for some trigger functions.
    But I would prefer to set the rigidbody to kinematic and control the character via abilities.

    Is it possible to modify the jump to set an upward velocity? (rather than adding a force)
    (I would require that it increases as long as the button is held up to a max value for variable jump heights based on button press duration)
    Setting velocity rather than adding force/velocity would stop the jump taking into account the character's current vertical speed which will fix the slope problem and is required for double jumps anyway (alternatively, setting upward velocity to 0 then adding a force should also work - the horizontal velocity should remain to allow for running jumps etc).
    Does air control work the same way? -taking into account the current horizontal speed and adding a horizontal force as the input direction is changed/held?

    Speaking of double jumps I noticed that wall jumps, double jumps, air dash and such are not included in the listed abilities in that video.
    How easy would it be to add these?
    Air dash for example would have to ignore gravity for it's duration. How easy would it be to duplicate and modify the roll ability with a separate animation, no requirement for being grounded, and gravity turned off at the beginning and on again at the end?
    (I'm not very proficient with coding but can generally understand and modify other people's code if it's well commented)

    Wall jump could be added by modifying the wall hanging code to allow the character to hang from any vertical wall (not just from corners), then jumping from wall hanging should work as normal provided it is already possible.

    Double jump would just require a counter that resets when grounded or wall hanging and allowing one extra jump when not grounded.

    I'm guessing non-physics movement could be added in the same way by adding horizontal velocity up to a cap as long as the user holds the appropriate direction?

    The way you've structured the ability system will at least allow me to turn these on one by one as the player unlocks each ability which is great.
    And if I can add my own abilities, can I store them in a separate folder so they won't be deleted when I download updates to your system?
     
  47. opsive

    opsive

    Joined:
    Mar 15, 2010
    Posts:
    5,125
    This is actually what I'm doing for version 2 - the character controller now handles all of the movement/collision detection and it's working really well. Unfortunately version 2 is still many motnhs away.

    The jump ability actually already just modifies the velocity rather then using AddForce so you're good there. It does add to the velocity rather then directly set it but you could change the += to a =.
    This part would require some changes to the jump ability but is definitely doable.

    While in the air you can change directions as the horizontal movement button are held down. This isn't controlled by an ability but you can definitely add an ability which is only active while in the air if you're looking for more fine-grain controls.
    The current jump ability does have an option to double jump (it's just not in any of the demos) but for the rest of those they would be a new ability. Take a look at this video for how to create a new ability:

    http://opsive.com/assets/ThirdPersonController/videos.php?id=7

    It would be similar to the Roll ability - the big difference is that you'd change the CanStartAbility method so it only returns true when the character is in the air.

    Yes, if you really wanted to you could completely stop the main character controller from updating and manage the movement completely on your own.

    Definitely, and is recommended.
     
  48. Stevepunk

    Stevepunk

    Joined:
    Oct 20, 2013
    Posts:
    205
    Thanks, I watched that video and just had one question.
    Because the balance state is called explicitly from code rather than from the animator, is it still possible to blend from walking to balancing? It was a bit jerky with 0 transition (mainly the arms jerked up in a single frame, but later there was no blended transition to the falling state either).

    Also, with enemy flanking/surrounding will they climb ladders and drop off ledges to flank/surround the player, or will they just use the ground plane (x/z) to run around?

    Aside from that it looks like this is what I'm after.

    One other thing, is it possible to use custom character rigs with this asset?
    My characters are currently flat 2D with bone animation with IK for hands and feet (as I was previously using 2D colliders).
    It's trivial to wrap them in a 3D capsule collider and point all of the animation states to my 2D bone animations (or perhaps even use the x/y data from the 3D animations and ignore the z stuff by locking z translation and rotation around x/y) but I'm curious if the IK would still function correctly eg. with ladders - x/y would still be the same for the rungs but any z info would be ignored.

    Perhaps there's another way around it or if I can't find a way around I may have to rig up some 3D voxel characters..
     
  49. opsive

    opsive

    Joined:
    Mar 15, 2010
    Posts:
    5,125
    You could add a transition animation within the ability when it ends - the Swim ability has an example of doing this.

    If you're using a NavMeshAgent then it'll take the shortest path, whether that includes any off-mesh links or not.

    Yes, generic characters are supported. Unity's IK system doesn't support generic rigs yet so that part won't work but the rest will. For that you could use something like FinalIK.
     
    Last edited: Jan 23, 2017
    Stevepunk likes this.
  50. SkyTech6

    SkyTech6

    Joined:
    Jul 14, 2015
    Posts:
    151
    @opsive have you tested out your Network Demo scene lately? I followed the setup instructions for it but there are numerous problems.

    The client lags around (but only on their screen), damage is super delayed, and when server kills the client it only happens on the server (client doesn't play death animation).

    Lotta weird things.
     
Thread Status:
Not open for further replies.