Search Unity

Third Person Controller (Third Person Shooter, Adventure, RPG, etc)

Discussion in 'Works In Progress - Archive' started by opsive, Dec 1, 2014.

  1. opsive

    opsive

    Joined:
    Mar 15, 2010
    Posts:
    5,127
    Awesome - this is really great to hear! We are going to go ahead and work on getting everything ready for submission and as soon as it is submitted we'll work on the demo scene some more. We should then have an update ready to go as soon as Unity has approved it for the Asset Store. I'm itching to get it out and there can always be polish :)

    I'm think that we are going to create a trello board for a roadmap that will allow voting for the features that should be included in the next release. This will allow us to easily see what is the most requested feature.

    Regarding the other issues, thanks, we are looking at all of the transition speeds now. For the NullReference, was that in the version that I sent you or from the web demo? I wasn't able to reproduce it and I think that code has changed a little bit since the version that you have. If 3 and 4 aren't included in the submission version they will be in the first update.

    Input.GetJoystickNames thought that there was a joystick connected even though there wasn't. It was then trying to get the axis for shooting since I have the fire button mapped to the controller's right trigger. The fix is to just try to get the button first and then if that fails try to get the axis.

    We'll look at issues 1-7 after we submit and it'll be in the first update.

    The sprint is a separate animation.
     
    eridani likes this.
  2. eridani

    eridani

    Joined:
    Aug 30, 2012
    Posts:
    655
    For the weapon aiming bit, one idea I just thought up is to shoot a raycast from the crosshair directly into the scene every once in a while, and whatever shootable object it collides with, the weapon will aim exactly at that point. That way the bullet will always hit exactly where the gun is pointed.

    I notice right now that when the player is near a shootable object (or aiming extremely up or down), the weapon points nowhere near the crosshair, yet the the bullet decal appears exactly at the crosshair, causing a slight loss of believability and immersion.

    I don't know if the raycast thing is a great idea or not but it was something that just came to mind right now. Maybe Tony can chime in on how effective/performant my suggestion is.
     
  3. opsive

    opsive

    Joined:
    Mar 15, 2010
    Posts:
    5,127
    The weapon is aimed by using a set of three animations: one for looking forward, one for looking up, and one for looking down. These animations are then blended based on the camera's pitch. When the weapon is actually fired a raycast will be fired in the direction that the camera is facing. The position that the raycast hits is then passed onto the weapon and the the weapon does some simple math to get the direction to shoot based on the weapon's fire point and the point that the camera's raycast hit. A few months ago I was actually completely positioning the weapon using IK but we switched to this animator-based system... I can't remember the exact reason now, I'll have to dig through the commits to see if I had a good log message for why I switched it. One of the first updates that I plan on doing is going back to this IK system and seeing if I can get it to work again. This way the weapon would always be facing in the correct direction looking at the crosshairs and no animations will be needed.
     
    eridani likes this.
  4. opsive

    opsive

    Joined:
    Mar 15, 2010
    Posts:
    5,127
    I just finished adding the documentation. This documentation gives a pretty good overview on how everything is structured and will walk you through using the builders for the character, item type, and item. The first three videos will be on these three builders as well.
     
  5. opsive

    opsive

    Joined:
    Mar 15, 2010
    Posts:
    5,127
    The Third Person Controller has been submitted!

    Submitted.PNG

    I posted a new thread in the Asset Store section. I'll still keep this thread updated with the WIP of new features.
     
  6. TonyLi

    TonyLi

    Joined:
    Apr 10, 2012
    Posts:
    12,697
    Congratulations, Justin! This is something the Asset Store has really needed for a long time.
     
    TheLetterS likes this.
  7. opsive

    opsive

    Joined:
    Mar 15, 2010
    Posts:
    5,127
    Thanks Tony! I really appreciate all of the feedback that you and everybody else provided.
     
  8. RaiuLyn

    RaiuLyn

    Joined:
    Sep 14, 2014
    Posts:
    39
    Played the demo. I ran into a few bugs along the way

    1. While running and switching weapons, it seems that the character's upper body reverted back to T-pose or whatever you call it.

    2. In the room with lots of wooden boxes, I happen to jump into wall of boxes and the character got bounced off as a result.

    3. I got on some boxes and the character froze in crouch pose(I don't know how, it just happened itself). Couldn't do anything to break out the froze state and all the functional keys I pressed are the weapon switching and the grenade option. The grenade option blew the character away and floats in midair literally. It's really funny that it turned out like this or that I have a knack of breaking things. What a nice sunset though. lol.
     

    Attached Files:

  9. opsive

    opsive

    Joined:
    Mar 15, 2010
    Posts:
    5,127
    Hah.. I actually really like that picture of the character looking at the sunset. Thanks, I'm recording some videos today and after I get done with those I'll take a look at those bugs.
     
  10. RaiuLyn

    RaiuLyn

    Joined:
    Sep 14, 2014
    Posts:
    39
    Glad you liked it. :D
    Main character looks at the sunset and thinks 'When can I get down from here?' with a tear in his eye. Poor guy. :(

    Consider implement switching camera target? By default, it looks to the right of the character. Maybe adding an option to switch to the left side? I would have taken a better picture with the left side view. :p
     
  11. opsive

    opsive

    Joined:
    Mar 15, 2010
    Posts:
    5,127
    Anything so you can get a better picture next time ;)

    There isn't an option to change it in game but you can change it within the Camera Controller inspector by changing the Camera Offset and the Zoom Camera Offset values:

    CameraController.PNG
     
  12. RandAlThor

    RandAlThor

    Joined:
    Dec 2, 2007
    Posts:
    1,293
    Would it be possible to ad more animations/movement options or will they come in an update?
    I mean animations like climb up/down on different hights like what your covering system does and swim/dive or take/put, push and pull things?
    Will adding more animations make them perform slower on mobiles?
    I can make my own animations but hope for a solution like yours where they will work in a controller.
    Hope for a tutorial on how to add my own animations to the controller and to connect them then to a special key to use them or like for example an automated "use" solution where the controller noticed what is in front and automatic starts to climb on a climbable object if i hit the w key again also i am to near to walk more on that direction.

    Edit:
    I hope i can use this with easy touch 4.
     
    Last edited: Jan 28, 2015
  13. opsive

    opsive

    Joined:
    Mar 15, 2010
    Posts:
    5,127
    First off, for those who are only subscribed to this thread and now the Asset Store thread, the Third Person Controller has been released on the Asset Store! You can get it here.

    You can add more animations now but it will take some scripting in order to trigger it. After a few days when things settle down from the release the first thing that I am going to do is change it so it requires the least amount of scripting possible. There are a few things that I know that I can be doing differently to reduce the amount that you have to script.
    We are planning on having an adventure type scene and these animations will be in it (though I don't know about swimming.. that one is planned but I don't know if it'll be in the initial scene.
    It'll take up more space but it shouldn't make things slower.
    I plan on doing a video and documentation on adding new animations. I haven't made it yet because I first want to reduce the amount of scripting needed.

    I haven't tested it on a 4th generation touch but the framework should be able to handle it. It was built with mobile in mind. The only thing that you'll want to make sure of if you are testing with the touch is that you disable the GUI. Right now it's using OnGUI which is obviously terrible for performance. I plan on adding a uGUI version sooner than later.
     
  14. OnePxl

    OnePxl

    Joined:
    Aug 6, 2012
    Posts:
    307
    /whispers: Easy Touch 4 is an asset on the store…
     
  15. opsive

    opsive

    Joined:
    Mar 15, 2010
    Posts:
    5,127
    hehe.. I guess my mind just skipped over the word 'easy' and read it as an iPod touch. That definitely changes my answer.. :)

    On mobile the Third Person Controller uses a system that is similar to the Sample Assets asset.To use EasyTouch you'd have to change the MobileInput class but that class is relatively basic and there isn't much logic in it so I don't think that it would be too hard. I can definitely help if something doesn't work, or if there is anything that I can change on the Third Person Controller side of things to make thing easier.
     
  16. twobob

    twobob

    Joined:
    Jun 28, 2014
    Posts:
    2,058
    Does it run completely garbage free?

    The default Unity one leaks 80b every time I call CharacterController.Move() and it infuriates me.
     
  17. opsive

    opsive

    Joined:
    Mar 15, 2010
    Posts:
    5,127
    It doesn't anymore :)

    There was one case where I was using a RaycastAll and that was leaking. I was able to switch it to a regular raycast and now it is leak-free. If you want the fix before the next version I can send it to you ahead of time.
     
  18. twobob

    twobob

    Joined:
    Jun 28, 2014
    Posts:
    2,058
    nah it's cool. Totally. respect for that.

    If you have a vote left... http://feedback.unity3d.com/suggestions/garbage-free-physics
    I noted the leak a while ago. and also on the relevant Official "Unity's Default Assets Create Garbage" thread, but it looks as though that is just another abandoned great-idea-at-the-time that no-one now ministers.

    Hey ho.

    Thanks again. Your stuff is great. I wish I was better at using behaviour designer. ;P
     
  19. opsive

    opsive

    Joined:
    Mar 15, 2010
    Posts:
    5,127
    Just added the votes that I had left :)
    I appreciate it! I'm am starting on a Third Person Controller example scene with Behavior Designer and the Movement Pack so that should provide another example of using Behavior Designer.
     
    twobob likes this.
  20. twobob

    twobob

    Joined:
    Jun 28, 2014
    Posts:
    2,058