Search Unity

  1. Megacity Metro Demo now available. Download now.
    Dismiss Notice
  2. Unity support for visionOS is now available. Learn more in our blog post.
    Dismiss Notice

Controller Third Person Templates by Invector

Discussion in 'Tools In Progress' started by Invector, Aug 20, 2015.

  1. wood333

    wood333

    Joined:
    May 9, 2015
    Posts:
    851
    I'm not really asking for something game specific. The heavy lifting is on my side, determining when to change the status of a player or npc from friend to enemy or neutral. That's the game specific part.

    What I am apprehensive about is being trapped in a box where player has to be tagged "player" and NPCs the player fights have to be tagged "enemy." If you leave it that way you are making life hard for the RPG genre.

    In reality, a real faction system is a matrix, and I already have assets that provide that. All I need is for the player and NPCs to have the ability to carry a list of enemy tags and teat all so tagged as enemies. Just, please not one lonely tag of Player vs Enemy, or, Red team vs Blue team. That's all.
     
  2. wood333

    wood333

    Joined:
    May 9, 2015
    Posts:
    851
    Thank you, @abatcat. Actually I already own Love/Hate, and also have use of the faction matrix system in Ork Framework. However, for my game, all I need is a simple list of tags on the NPC/Player, as opposed to being limited to just "Player" "NPC" or "Red Team" "BLue Team."

    Always, thank you for advice. :)
     
  3. Invector

    Invector

    Joined:
    Jun 23, 2015
    Posts:
    966
    Oh don't worry @wood333 we already add the list :p
     
    wood333 likes this.
  4. Invector

    Invector

    Joined:
    Jun 23, 2015
    Posts:
    966
    We already have a Health Recovery system lol, take a look into the Player/AI Inspector ;)
     
  5. sean3Dmonkey

    sean3Dmonkey

    Joined:
    Oct 21, 2014
    Posts:
    69
    I just sent you an email with screen grabs of our process. Thank you for your assistance.
     
  6. indra-p

    indra-p

    Joined:
    Mar 12, 2013
    Posts:
    38

    hello...i just tried to create the enemy and weapon by following the tutorial from youtube...now the ai folow me...i can pick up the weapon on the ground..the attack animation work when i pres the click button...its cool.... but the problem is, there is nothing happen to the enemy when i hit him... he dont feel anything..he wont die or dodge or anything...i did set the damage value to 30 as shown in the tutorial.... what posibly i did wrong?
    and also as shown in the image above the enemy's feet dont touch the ground...how i can fix it?
     
    JamesArndt likes this.
  7. snackzilla

    snackzilla

    Joined:
    Aug 17, 2014
    Posts:
    91
    I can answer the floating question, I think, as I've had this happen on a few of my older models. Take a look at the leftFootTrigger, and rightFootTrigger on your model. (Should be children of the respective feet) The sphere collider for them is probably way too big or positioned incorrectly. Fortunately, it's an easy fix. Just resize the collider to your foot, and adjust the position manually. You can do this while the game is playing in the scene view to get it perfect. I'd also take a look at your layers, just to be sure they're set up correctly. Make sure your enemy is on the layer "Enemy", and also has the tag "Enemy".
     
  8. Invector

    Invector

    Joined:
    Jun 23, 2015
    Posts:
    966
    As snackzilla say, take a look into your enemy layer and also check your weapon hitbox & layer, make sure it's the right size.

    The character is floating because when you bake a navmesh, the navmesh is always a little bit higher then the mesh it self, so you need to apply a NavMesh Offset on the Agent. Don't forget to adjust your capsule collider as well, otherwise your player will be flickering they collide with each other, for example if you put a off set of -0.05, then you need to apply +0.05 in the capsule collider center to equal.
     
  9. fluidImages

    fluidImages

    Joined:
    Sep 27, 2013
    Posts:
    29
    In the file LockOnTarget.cs

    The line:214 - reads:
    System.Array.ForEach<RaycastHit>(targets, delegate (RaycastHit hitOther)

    It is throwing this error on a Universal windows store build:
    Assets\Invector-3rdPersonController\Scripts\Camera\LockOn\LockOnTarget.cs(214,19): error CS0117: 'Array' does not contain a definition for 'ForEach'

    The error is only thrown when building.

    Would you know how to fix this?

    Sean
     
  10. indra-p

    indra-p

    Joined:
    Mar 12, 2013
    Posts:
    38
    thanks..its work now...i edited the navmest and now the feet touch the ground....and the ai now can dodge and die after i edited the capsuse collider...its too small before.... but now there is another problem...now the player ignoring the enemy's attack...whenever the enemy hit the player..there is nothing happen to the player...he wont die or hurt...
    as i shown in this image i think the collider of the player is big enought to get hit by the enemy's weapon... so what probably i did wrong?
     
  11. Invector

    Invector

    Joined:
    Jun 23, 2015
    Posts:
    966
    What do you mean by "when building"? you just need to add a Lock-On component into the camera after the creation of a character.

    This capsule looks small try 0.3 radius, but this is just a obervation, the issue of not detecting the hit is definitely layer, don't forget that when you change your character's layer, you change all of his children gameobject including the weapon if hi is equipped with one, so you need to change the weapon to triggers again.
     
  12. Rexoto-Games

    Rexoto-Games

    Joined:
    Jan 11, 2013
    Posts:
    41
    array.foreach does not work on windows store so you will need to change it to the generic foreach instead which works like this:
    foreach(RaycastHit raycast in targets)
    This is just pseudo code so you will need to figure out how to replace the foreach in the code with this one.
     
  13. indra-p

    indra-p

    Joined:
    Mar 12, 2013
    Posts:
    38
    oh okay thanks again...yeah its the layer, i typed it player when it should be Player...ny mistake..but now its work... the player dead and respawn... but why the lighting changed darker after he respawn?...i used the default lighting since i do everything in a new fresh scene...
     
  14. fluidImages

    fluidImages

    Joined:
    Sep 27, 2013
    Posts:
    29
    Invector,

    Its a problem with building for the windows store - It appears as though that function does not exist in the .NET framework used for the Universal Windows Build.

    This one:
    System.Array.ForEach<RaycastHit>(targets, delegate (RaycastHit hitOther)

    It plays, but when you build (create a solution for Universal Windows, it fails.

    Sean
     
    Last edited: Apr 17, 2016
  15. Rose-Remnant

    Rose-Remnant

    Joined:
    Nov 14, 2012
    Posts:
    123
    Can you make a new ai setup video?
     
  16. Invector

    Invector

    Joined:
    Jun 23, 2015
    Posts:
    966
    Oh don't worry, this only happens on the Editor, if you export a build it will load the lights as usual, it's a Unity thing lol.

    Hmm interesting, we actually never export a window build (and I think you're the first one here lol), but we will take a look, this 'foreach' solution that @thisnamesucks say seems to work

    I will make one, after the release of v1.3 which has some changes, but it's really easy to set up just like the player you just drag and drop the model fbx, set up the layers and bake a navmesh. It's all in the documentation.
     
    Last edited: Apr 18, 2016
  17. Rose-Remnant

    Rose-Remnant

    Joined:
    Nov 14, 2012
    Posts:
    123
    Very cool, I just bought this package and am trying to set up my Angels of deaths as enemies would be very helpful to see how a proper enemy from scratch works. They hover, not walk so kinda interesting to get setup
     
    Last edited: Apr 18, 2016
  18. Rose-Remnant

    Rose-Remnant

    Joined:
    Nov 14, 2012
    Posts:
    123
    Well until I figure out the ai here is a sample scene for a game that I have been working on with this new system:
     
    Invector and abatcat like this.
  19. Hamesh81

    Hamesh81

    Joined:
    Mar 9, 2012
    Posts:
    405
    Hi there Invector, great asset you have. I'm just wondering if there are still plans to develop a more shooter focused template/addon for this controller? I remember it being mentioned at the beginning of the thread, but could not find an update since. Alternatively I would also be curious about a more advanced climbing system (eg. ledge climbing), but I understand if your focus is on the melee template at the moment.
     
  20. Korok

    Korok

    Joined:
    Dec 19, 2011
    Posts:
    179
    I prefer melee though there're too many 3rd shooter templates out there
    Invector your template is awesome, the best!!!

    But for a non-coder user like me, since it's a "complete project" would you please, beside those advanced features like "hit boxes", make it more complete with some basic features like save, load, options screen, basic UI, simple dialogue, pick up health pack, pick up coins - point, moving platform, death trap, simple quest etc. cos just jumping and slashing is good but not enough

    Can't wait til your 1.3 update XD
     
  21. Rose-Remnant

    Rose-Remnant

    Joined:
    Nov 14, 2012
    Posts:
    123
    Those are easy to do with Canvas, honestly takes like 5 min to create a main menu or a pause menu. That being said an inventory system or save system would be fitting for this project.
     
  22. Invector

    Invector

    Joined:
    Jun 23, 2015
    Posts:
    966
    Pretty cool choice of assets, it looks beautiful :)
    - Please take a look into the documentation, it's REALLY easy to set up the AI, just like the Player.
    I promisse that I will make a tutorial as soon as we finish v1.3.

    Yep, we have plans to starts the Shooter Template very soon :)

    Our focus is to delivery a 3rd Person Controller Template and not a 3rd Person Game Template, there is other assets who focus on save/load, inventory system, etc... that you can integrate and create your game.
     
    Hamesh81 likes this.
  23. Rose-Remnant

    Rose-Remnant

    Joined:
    Nov 14, 2012
    Posts:
    123
     
  24. abatcat

    abatcat

    Joined:
    Feb 8, 2015
    Posts:
    70
  25. fluidImages

    fluidImages

    Joined:
    Sep 27, 2013
    Posts:
    29
    Well.. I actually published in on the Xbox one using (UWP).. since MS just released the ability to deploy it and use a commercial device as a developer one.

    Not sure if its 100% supported by Unity yet.. I did it with no real issues (I actually hid all references to target lock to get it to publish). It was crazy slow, but hopefully they will improve over time!

    I will look into it as well, but if you resolve the issues, please let me know.

    Sean
     
  26. snackzilla

    snackzilla

    Joined:
    Aug 17, 2014
    Posts:
    91
    Hello again Invector! I'm back with another quick suggestion :) Weapon Collision sounds! Should be pretty easy to implement, and I think the kit would benefit greatly from it. Could even vary depending on material hit, yeah? Thanks for taking the time to listen to us independent devs. Really the difference between a failed, and a successful asset.
     
  27. kurotatsu

    kurotatsu

    Joined:
    May 10, 2012
    Posts:
    588
    I love the new melee system(got it running with InControl again.).

    Melee and Ai suggestions(I'm sure at least some of these are already on your list.:p):

    1. Swing and hit sounds per weapon(as Snackzilla said).

    2. Got hit sounds for the Ai and player, I'd suggest an array with random for which plays.

    3. Array of random percentage of item drops for AI, would be great for health/stamina pickups, or weapons(other than what the Ai is using.).

    4. The ability to sneak up on enemies, and do a stealth kill anim per weapon(can be handled with a trigger box behind them that is available only while they are unaware of the player.).

    5. On death for AI the option to have body disappear after a set time, set in the inspector.

    6. A video on setting up an unarmed attack for when unarmed.

    7. A video on making a health and stamina pickup(or a possible wizard added to the system).

    8. A particle effect on hit, at hit point of weapon on AI(maybe a different one for mid weap hit box and tip hit box.).

    9. A effect dropped on death at AI, or player transform pos.(great for blood pools)

    I only suggest these as a way to help round out the melee system, the more well rounded, the bigger the popularity, and sales.

    I truly believe this system can be a go to system, and offer this to help.
     
  28. Korok

    Korok

    Joined:
    Dec 19, 2011
    Posts:
    179
    +1
     
  29. Invector

    Invector

    Joined:
    Jun 23, 2015
    Posts:
    966
    We heard you guys, and as I posted a few pages back here is the roadmap so far:

    Update v1.3
    - AI vs AI
    - Companion AI
    - Agressive / Passive behaviour
    - Companion Commands (Follow, Stop, MoveTo)
    - Weapon defense / Shield attack (generic melee weapon)
    - Hand to Hand combat (hands and legs hitbox created automatically)
    - Audio slot for weapons and Animation State
    - Particle slot for hit reaction

    We already have 80% of this list done :D
     
  30. Cartoon-Mania

    Cartoon-Mania

    Joined:
    Mar 23, 2015
    Posts:
    320
    wow. audio sound and particle! great!
     
  31. snackzilla

    snackzilla

    Joined:
    Aug 17, 2014
    Posts:
    91
    Awesome! I can't wait to try it out. I've got a quick question. I'm messing with my own jump/jumpMove animations..For some reason, whenever I try to jump from block to block (like the green ones in your 3rdPersonController demo scene), Even if the character is high enough, when he reaches the end of the next block, it's like he hits a collider and is unable to actually land on it. Is there something I'm missing? I'll upload a video or gif to show you what I'm talking about here soon.

    EDIT: Here's the video of what I'm talking about. Please excuse the quality. My screengrab software is subpar.



    Upon further inspection, it seems the animation is actually playing outside the collider, like this. Anyone know an easy remedy to this? I'm using root motion if it matters.

     
    Last edited: Apr 20, 2016
  32. Rose-Remnant

    Rose-Remnant

    Joined:
    Nov 14, 2012
    Posts:
    123
    Hand to hand combat will be awesome, and a must for at least the model I use, he carries a hand held weapon, could use the hand to hand combat system to full effect
     
    Last edited: Apr 20, 2016
  33. Invector

    Invector

    Joined:
    Jun 23, 2015
    Posts:
    966
    Try checking the options Bake Into Pose and set Base upon Feet on the Root Transform Position (Y) of you animation
     
  34. snackzilla

    snackzilla

    Joined:
    Aug 17, 2014
    Posts:
    91

    Actually that was the issue is that the Bake Into Pose on Root Transform Position Y was checked. Odd. I don't have that problem on any other animation but the jumpMove and jump. Once I uncheck Bake Into Pose on Root Transform Position Y, the capsule collider follows as it should. I've tried it baked upon Feet, Original, and Center of Mass, and still it won't follow. Not a huge issue, I just unchecked it. Thanks again for the help. :)
     
    Invector likes this.
  35. googlebac

    googlebac

    Joined:
    Feb 1, 2015
    Posts:
    56
    Hi @Invector I have a horse combat game that I'm trying to prototype. would it be possible to change the setup so non-humanoid characters could be used also? Invector is perfect for to start with and I have all of my animations ready. Just need to set the character up with a third person system with combat.
     
  36. kurotatsu

    kurotatsu

    Joined:
    May 10, 2012
    Posts:
    588
    Excellent, glad to hear things running on track, and I can't wait to try ver 1.3 for sure.
     
  37. kurotatsu

    kurotatsu

    Joined:
    May 10, 2012
    Posts:
    588
    I need to add a send message to my player from an AI when he dies for my game manager, to add points.

    Which Ai script has the on die method, where I can place this.
     
  38. sticklezz

    sticklezz

    Joined:
    Oct 27, 2015
    Posts:
    33
    Wondering- where did the jump height / speed and jump air control adjustments move to? can't seem to find them anymore
     
  39. jmacgill

    jmacgill

    Joined:
    Jun 17, 2014
    Posts:
    17
    @kurotatsu How dead do you want your AI to be?
    Odd question I know but.. the second health hits 0 there is a DropWeapon message but if you want to wait for death animations to finish you will have to play with the Death Animation code which I think was up in AI motor.

    I added my own message to CheckHealth which is called (most of the time?) when health changes.

    I'd love to see either a lot more messages built into the system or a shift to composition over inheritance to make it easier to swap in alternative input/health/ai functionality.
     
    TeagansDad likes this.
  40. Invector

    Invector

    Joined:
    Jun 23, 2015
    Posts:
    966
    Hmmm I don't think so, we use humanoid because it's easier to find a bone by code and runtime and we use this feature a lot. If you use generic, you will have to assign bones a lot, maybe it's possible to do, I will add on the to-do list to take a look, there is a few people that have request this already.

    Take a look at the AIMotor, method CheckHealth

    Painel Actions, below the ThirdPersonController script on the Player Inspector
     
    googlebac and kurotatsu like this.
  41. kurotatsu

    kurotatsu

    Joined:
    May 10, 2012
    Posts:
    588
    Thanks, got it working, and I should be able to add some of my earlier suggestions now without hassling you guys much.
     
    Invector likes this.
  42. googlebac

    googlebac

    Joined:
    Feb 1, 2015
    Posts:
    56
    Thanks for looking into it. I can already see how good the AI would be in such a situation. The plan for me is to use a system like the swinging spheres on the player character so if you charge into one of them they ragdoll and take damage. giving them the ability to roll out of the way really helps too. If it became possible to use generic rigs my game would be off to a flying start and let me divert my limited resources to other aspects of the game such as visuals.

    Thanks again and good luck with your roadmap mate.
     
    Invector likes this.
  43. Rose-Remnant

    Rose-Remnant

    Joined:
    Nov 14, 2012
    Posts:
    123
    Anyone here know a good potion re gen asset?
     
  44. Korok

    Korok

    Joined:
    Dec 19, 2011
    Posts:
    179
    I purchased this one and quite pleased



    potion, also dragon eggs :D
    https://www.assetstore.unity3d.com/en/#!/content/27871
    @Invector: so as I understand the player and enemies use the same animation system right(?), so if I want to use specific anim set for each enemy I have to create a new character template? Please make a more detailed tutorial for this, this part in your tutorial is super short
     
  45. googlebac

    googlebac

    Joined:
    Feb 1, 2015
    Posts:
    56
    Hi when I need to do that I just duplicate the animation controller, rename it and swap out the animations. As long as they work with the avatar / rig you have on the desired model then it should be fine. hope that helps.
     
    Korok likes this.
  46. ScaraBe

    ScaraBe

    Joined:
    Oct 7, 2015
    Posts:
    43
    Is there a clean way to instantiate new enemy?
    I got this error each time I instantiate one:

    NullReferenceException: Object reference not set to an instance of an object
    Invector.AIAnimator.OnAnimatorMove () (at Assets/Invector-3rdPersonController/Scripts/CharacterAI/AIAnimator.cs:420)


    The error is on the first line of OnAnimatorMove(), so I have checked the navmeshagent (enabled, radius ok, agentpath drawed, navmesh ok...), all seems ok, but AI don't move in patrol mode or stay in idle mode :eek:

    PS: All works great when AI is not instantiated.
     
  47. Korok

    Korok

    Joined:
    Dec 19, 2011
    Posts:
    179
    Thanks a lot :D I'll try it
     
  48. Invector

    Invector

    Joined:
    Jun 23, 2015
    Posts:
    966
    We made a spawn system for that knight demo, I will include on the next update.
    You can limit the number of enemies spawned, delay to spawn, etc... I never got this error by instantiate the prefab.

    Just ctrl+c ctrl+v the Animator and replace the animations, I thought it was pretty obvious but my fault, I will add this information on the documentation ;)
     
    Korok likes this.
  49. ScaraBe

    ScaraBe

    Joined:
    Oct 7, 2015
    Posts:
    43
    Good idea to include a spawn system in your demo, I think those demos will be awesome.
    I have my own spawn system for animals, but for a mysterious reason it doesn't works with your characterAI :(, so I will take a look on the knight demo!

    Another thing, I saw on your website, some models holding fireweapon & it looks beautiful, is it a preview of your future baby (shooter addon) :cool: ?
     
  50. wood333

    wood333

    Joined:
    May 9, 2015
    Posts:
    851
    While waiting for TPCT v1.3, we decided to go horseback riding.

    Mounted V Bot.PNG
    Here, the intrepid V-bot is added to a Horse Animset Pro demo scene. https://www.assetstore.unity3d.com/en/#!/content/48700 With a few scripts dropped on, the V-bot can approach and mount the horse. At that point, the Horse controller takes over and the V-bot uses the provided riding animations. The only draw back out of the box, is that when the Horse Animset Pro controller takes over, the TPCT camera shuts down. This is probably not a big deal, as a custom camera controller should get around that issue.

    When the V-bot dismounts, the TPCT controller is re-enabled, and back in control with no apparent undesirable side effects. This is a good system for travel, but would require more work if combat were to take place on horseback.

    We think it would be cool if these assets continue to play nice with each other. ;)
     
    Invector, ScaraBe, kurotatsu and 2 others like this.