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

    opsive

    Joined:
    Mar 15, 2010
    Posts:
    5,127
    I was able to reproduce it and the problem is that the OnAnimatorStartJump animation event isn't firing when it should. Like you said, when the PuppetMaster component is disabled it works all of the time so there is something going on in that component. I would ask Partel if he has any ideas what would cause an animation event to be delayed when PuppetMaster is active. Unfortunately I don't have enough PuppetMaster experience to know the inners of it.
     
  2. lazygunn

    lazygunn

    Joined:
    Jul 24, 2011
    Posts:
    2,749
    While waiting for a response from Partel, can you say whether a root motion jumping animation is practical with the TPS, in which case I'd try implement it similarly to the roll ability I guess, are there any complications to watch for there?

    Another thought I had which you could maybe help with is if if we're to have a less elaborate physics based jump ability that didn't rely on the phase of the controller starting the jump. For my uses transitioning straight into a jump would be fine
     
  3. opsive

    opsive

    Joined:
    Mar 15, 2010
    Posts:
    5,127
    When the character is in the air by default they don't use root motion. Your jump ability will need to override the UpdateMovement method to use root motion instead of not. This is a little bit different than the roll ability because roll is always on the ground so by default it'll use root motion.

    Sure, for that you'd just need to modify the GetDestinationState of the jump ability and return the actual jumping state rather than a starting state.
     
  4. lazygunn

    lazygunn

    Joined:
    Jul 24, 2011
    Posts:
    2,749
    I tried the latter and I still got that hovering effect. I tried changing the float parameter passed to the animation controller as well as messing around with the blend tree for the ability but was still being strange.

    Watching the blend tree in action, the pause seems to be caused by a slow increase in the float data parameter, at the end of this it pops into a jump. Unfortunately however I set the state in the ability script or try to change things for the controller I still get the odd behavior.
     
  5. opsive

    opsive

    Joined:
    Mar 15, 2010
    Posts:
    5,127
    There's a second version of AnimatorMonitor.SetFloatData which takes a float as the second parameter specifying the dampening time. You could pass in 0 to this and then the parameter will be set instantly.
     
    julianr likes this.
  6. lazygunn

    lazygunn

    Joined:
    Jul 24, 2011
    Posts:
    2,749
    Thanks for the suggestion, unfortunately still didn't work. It looks like puppetmaster may be suppressing the rigidbody's velocity maybe?
     
  7. opsive

    opsive

    Joined:
    Mar 15, 2010
    Posts:
    5,127
    Are you saying that the parameter didn't get set to the desired value instantly or something else? I don't think that PuppetMaster would be suppressing the Rigidbody velocity.
     
  8. lazygunn

    lazygunn

    Joined:
    Jul 24, 2011
    Posts:
    2,749
    It didn't switch to the main jump animation without a hover still. Checking the animator controller again just flickers at values of 0 and negative numbers - this number is generated from the velocity isn't it? It's like the number is being clamped before finally popping into the animation
     
  9. opsive

    opsive

    Joined:
    Mar 15, 2010
    Posts:
    5,127
    I just outputted the values to see what you're seeing. Here's a sample of what I get:

    Start Ability
    0
    -2.384186E-06
    -7.152557E-06
    0
    -1.311302E-05
    ...
    OnAbilityStartJump event
    4.8038
    4.6076

    So before the event the values are basically 0. This goes along with what I mentioned earlier in that the PuppetMaster component is preventing the animation event from playing. When the character is moving this event should occur immediately so you shouldn't get any values near 0 at all in the beginning.

    My guess is that PuppetMaster is delaying the transition to the jump animation so the event doesn't fire until the second time the animation plays. I just tested this by moving the OnAnimatorStartJump events in the WalkMidAirLeft and WalkMidAirRight animations so instead of them occurring at 0 they occur 0.17 into the animation. When I did this the PuppetMaster character jumped successfully every time. I'll make this change in the Asset Store version so nobody else will get caught up by it if they're using the PuppetMaster integration.
     
    Last edited: Jul 26, 2016
    julianr and lazygunn like this.
  10. lazygunn

    lazygunn

    Joined:
    Jul 24, 2011
    Posts:
    2,749
    Tried that, worked perfectly, thanks again for the excellent support
     
    opsive likes this.
  11. Gametyme

    Gametyme

    Joined:
    May 7, 2014
    Posts:
    618
    Is TPC fully compatible with unity 5.4?
     
  12. opsive

    opsive

    Joined:
    Mar 15, 2010
    Posts:
    5,127
    Yes
     
    Gametyme likes this.
  13. Artificialized

    Artificialized

    Joined:
    Oct 5, 2014
    Posts:
    69
    How hard would it be for you to add a leveling system such as experience gaining,resource gathering like woodcutting minning,fishing,?Would be really neat and useful for adventure/rpg or any type of third person game
     
  14. Arganth

    Arganth

    Joined:
    Jul 31, 2015
    Posts:
    277
    Probably not in the scope of tpc
    but take a look at inventory pro
    there is a integration pack for it and it is a great package
     
  15. opsive

    opsive

    Joined:
    Mar 15, 2010
    Posts:
    5,127
    @Arganth is right - that's a bit outside of the scope of a character framework :) If the Inventory Pro package doesn't work for you and there's another asset which you feel would work better let me know and I can possibly do an integration with it.
     
  16. TeagansDad

    TeagansDad

    Joined:
    Nov 17, 2012
    Posts:
    957
    ORK Framework can handle all of that. There is a tutorial for harvesting resources on the main site.

    I'm working on an in-depth integration package between ORK and TPC that might be of interest to you: http://forum.orkframework.com/discu...-third-person-controller-preview-available/p1

    I'm aiming to make the integration as seamless as possible.
     
    opsive and chiapet1021 like this.
  17. magique

    magique

    Joined:
    May 2, 2014
    Posts:
    4,030
    Justin, I saw yesterday that Inventory Pro is getting a huge upgrade that will be a separate package and is not going to be backward compatible to the current version. What will be the timeline for an updated TPC integration?
     
  18. opsive

    opsive

    Joined:
    Mar 15, 2010
    Posts:
    5,127
    I just looked at the Inventory Pro thread - that is a huge update. I'm not sure on a timeline, I'll first need to see exactly what has changed related to how items are equipped in order to have a better estimate. I'll let you know after it has been updated (it doesn't look like the Asset Store has approved the new version yet.)
     
  19. magique

    magique

    Joined:
    May 2, 2014
    Posts:
    4,030
    OK, thanks.
     
  20. magique

    magique

    Joined:
    May 2, 2014
    Posts:
    4,030
    New question. I haven't upgraded to 1.3.2 yet and haven't thought about this or tried with the past couple of versions, but at one time I had asked if the wall climb ability could be expanded so that you could have multiple climb zones and be able to cross over to them while climbing. So, you could have a case where you are climbing up a narrow vertical section and at one point an area to the left or right opens up and the character can then move in those directions. This is common in Tomb Raider type games. Anyway, I was wondering if you ever added that or if it's still on your TODO list?
     
  21. opsive

    opsive

    Joined:
    Mar 15, 2010
    Posts:
    5,127
    It's not in the current version but an improved climbing system will be coming to version 1.4.
     
    magique likes this.
  22. MrIconic

    MrIconic

    Joined:
    Apr 5, 2013
    Posts:
    239
    Been trying to find something that will allow walking/running (climbing) up stairs for a little while now since I feel like it's out there. Then I noticed stuff about climbing with the Third Person Controller asset but is this (the video) even possible in Third Person Controller... or anything you know of?

     
  23. opsive

    opsive

    Joined:
    Mar 15, 2010
    Posts:
    5,127
    That stepping looks similar to the Short Climb ability. The current Short Climb ability has the character bend down and push themselves up to get up a large step, but you could replace those animations with an actual stepping animation.
     
  24. magique

    magique

    Joined:
    May 2, 2014
    Posts:
    4,030
    I have a small request. Could you make the NormalFOV field public in future versions? I have a need to adjust that at runtime when I switch to my indoor scenes. I want outdoor to have a more expansive feel and indoors to be a bit more cramped looking. I modified the script myself very easily, but I'd rather not have to do it each time I upgrade.

    EDIT: I think I should retract this. It seems that the new CameraState feature is the way to handle this now. Is that correct?
     
    Last edited: Jul 30, 2016
  25. lazygunn

    lazygunn

    Joined:
    Jul 24, 2011
    Posts:
    2,749
    I was surprised by this too, i suppose speaking for Opsive - yes camera states are very useful and help you set most aspects of a camera, the only problematic things i ran into were VR handling (you need to disable the FOV handling in the source for example as far i could tell) and fixed cameras
     
  26. magique

    magique

    Joined:
    May 2, 2014
    Posts:
    4,030
    What is the proper way to turn off the new recoil feature? I don't want any kind of weapon or character recoil. It's currently using it, but complaining because the Upper Layer for the weapon doesn't have a Recoil state. I started with the Adventure controller, which seems to have Recoil Left and Recoil Right, but the code is trying to simply access a state named Recoil. In any case, I'd prefer to have it not do the recoil at all. At least for now.
     
  27. opsive

    opsive

    Joined:
    Mar 15, 2010
    Posts:
    5,127
    @lazygunn is right - you'll want to use camera states Also, all fields in 1.3.2 are protected so you can easily subclass and add a new property (you won't need to do that in this case though):

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

    Did you remove the "Zoom" state from the CameraHandler?

    There isn't a built in way right now but you can add it by changing the following within MeleeWeapon.OnCollisionEnter:
    Code (csharp):
    1.  
    2.   m_Recoil = true;
    3.   EventHandler.ExecuteEvent(m_Character, "OnUpdateAnimator");
    4.  
    to:
    Code (csharp):
    1.  
    2.   var recoilState = m_RecoilStates.GetState(0, m_Controller.Moving);
    3.   if (recoilState != null && !string.IsNullOrEmpty(recoilState.Name)) {
    4.   m_Recoil = true;
    5.   EventHandler.ExecuteEvent(m_Character, "OnUpdateAnimator");
    6.   }
    7.  
    If you leave the recoil item state blank it'll no longer try to transition to it.
     
  28. lazygunn

    lazygunn

    Joined:
    Jul 24, 2011
    Posts:
    2,749
    I did remove the zoom state. For some reason whatever I set the camera states to, including my own, the view would skew as fov changed with the VR camera, maybe i'm mistaken, but yes the asset would be absolutely great with some VR TLC
     
  29. opsive

    opsive

    Joined:
    Mar 15, 2010
    Posts:
    5,127
    So the fov would change? It should only change if you're changing camera states and the fov is different (this is independent of VR).
     
  30. lazygunn

    lazygunn

    Joined:
    Jul 24, 2011
    Posts:
    2,749
    That's what I found, and I guess I did find it odd, even with the zoom camera state there was no reason to trigger it and just set the camera states to have a VR recommended fov of 90 or so, although fov should just be left completely alone in vr anyways. It's hard to say things are independent of vr when things like camera position is not taken into account with a VR camera - vr camera positions and relative rotations need to be given to a transform acting as a parent to the vr camera or it will be overriden
     
  31. magique

    magique

    Joined:
    May 2, 2014
    Posts:
    4,030
    Do you mean the Idle, Movement, and Abilities Recoil States in the item's Character Animator Options? If so, those can't be deleted. If you mean something else then I am not sure where it is to change.
     
  32. opsive

    opsive

    Joined:
    Mar 15, 2010
    Posts:
    5,127
    Instead of deleting, you can just set an empty state name.
     
  33. magique

    magique

    Joined:
    May 2, 2014
    Posts:
    4,030
    It seems to work with just the code changes and not messing with the state names at all.
     
  34. opsive

    opsive

    Joined:
    Mar 15, 2010
    Posts:
    5,127
    That works :) My guess is that your recoil state doesn't have a base layer so it returned null and didn't even have to check the state name.
     
  35. TommiH

    TommiH

    Joined:
    Jan 14, 2008
    Posts:
    253
    Hello again,

    We're using Third Person Controller for a multiplayer game. However, we've been using Photon for previous projects and trust its quality more than we trust UNet (which we've never used). But the multiplayer integration of TPC uses UNet. Do you think it would be difficult for us to use Photon instead? This thread seems to suggest it's very difficult. My main concern is that you've done a lot of work to get the Third Person Controller to synch nicely between different clients, and that I'd have to replicate all that work if I tried to use Photon.

    Thanks for all of your amazing help so far!
     
  36. opsive

    opsive

    Joined:
    Mar 15, 2010
    Posts:
    5,127
    I have not used Photon very much so unfortunately I'm not sure what is involved. When the Third Person Controller is integrated with UFPS I plan on taking a closer look at Photon integration since UFPS has a Photon multiplayer addon.
     
  37. TommiH

    TommiH

    Joined:
    Jan 14, 2008
    Posts:
    253
    Thanks!

    Though I'd still be interested in knowing if you did a lot of clever things and fine-tuning for the uNet integration or whether it was a fairly straightforward matter.
     
  38. opsive

    opsive

    Joined:
    Mar 15, 2010
    Posts:
    5,127
    Networking is never straight forward :) My best advice is to have lots of patience and take things one step at a time. When I added UNET integration I first synced the movement, followed by the abilities, and then the items. You'd probably want to do something similar with Photon.
     
  39. TommiH

    TommiH

    Joined:
    Jan 14, 2008
    Posts:
    253
    I might have found a bug. If I add a new ability and make it the first, the previously first ability's .Index is not updated, so now they both have index 0. Not sure about the exact repro steps, though. It seems to work sometimes.
     
  40. opsive

    opsive

    Joined:
    Mar 15, 2010
    Posts:
    5,127
    Let me know if you can reliably reproduce it. RigidbodyCharacterControllerInspector.OnAbilityListReorder should be called when you reorder the ability list. Is that method not always being called for you?
     
  41. TommiH

    TommiH

    Joined:
    Jan 14, 2008
    Posts:
    253
    I figured it out: It wasn't dirtying the abilities, only the RigidbodyCharacterController in the OnAbilityListReorder function. When I added this line on RigidbodyCharacterControllerInspector:312, it started working:

    EditorUtility.SetDirty(m_Abilities.GetArrayElementAtIndex(i).objectReferenceValue as Ability);
     
  42. opsive

    opsive

    Joined:
    Mar 15, 2010
    Posts:
    5,127
    Good catch - thanks!
     
  43. TommiH

    TommiH

    Joined:
    Jan 14, 2008
    Posts:
    253
    If I use root motion, should I expect the character to move exactly at the same speed as the root motion animation dictates (let's say, on perfectly flat terrain)? Or should I expect friction to slow it down? It looks like friction does slow it down for me, which makes it a little harder to match things nicely together (things such as feet on ground).
     
  44. opsive

    opsive

    Joined:
    Mar 15, 2010
    Posts:
    5,127
    In addition to the physics material, there is a dampening value on the RigidbodyCharacterController which will also slow the character down.
     
  45. TommiH

    TommiH

    Joined:
    Jan 14, 2008
    Posts:
    253
    Is there a nice way to circumvent anything that would interfere with the root motion taken from the animation? I need to do some precise matching, so I need to rely on the motion being the same as in the animation..
     
  46. opsive

    opsive

    Joined:
    Mar 15, 2010
    Posts:
    5,127
    If you set the dampening to 0 and are using the frictionless material then it'll match the animations.
     
  47. TommiH

    TommiH

    Joined:
    Jan 14, 2008
    Posts:
    253
    OK, thanks!
     
  48. opsive

    opsive

    Joined:
    Mar 15, 2010
    Posts:
    5,127
    A new Inventory Pro integration has been added to the integrations page. Thank you @jorisshh for doing the bulk of the changes :)
     
  49. TommiH

    TommiH

    Joined:
    Jan 14, 2008
    Posts:
    253
    And now I'm trying to have this leave the ground, but even if I override CheckGround to return false on my ability and make RootMotionForce = Vector3.up * 10 in UpdateMovement (which returns true), my character still insists on sticking to the ground. I don't understand how the Jump ability does this.
     
  50. opsive

    opsive

    Joined:
    Mar 15, 2010
    Posts:
    5,127
    The Jump ability uses Rigidbody.AddForce to add the force rather than root motion. If you are overriding CheckGround you'll want to set the Grounded property to false and also enable gravity manually. In addition, when the character is in the air the controller doesn't use root motion so if you do then you'll want to add that within UpdateMovement.
     
Thread Status:
Not open for further replies.