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

    painkiller2007

    Joined:
    May 25, 2013
    Posts:
    44
    @Invector You have a bug when someone uses left hand as a weapon instead of defense..

    Around at line 175 in vMeleeManager.cs , if I use my left hand weapon as defense and attack...there is no setting of attack id for attack from left weapon... Left hand weapons can only be used as defense ? Then why is the option for both defense and attack given for left hand weapons too..

    Also in line 572 in vThirdPersonController... there should be a check for left hand on side= -1... it is checking for right hand equip again in side = -1 which is why we are not able to equip weapons if they are supposed to equip on left hand.
     
  2. Rexoto-Games

    Rexoto-Games

    Joined:
    Jan 11, 2013
    Posts:
    41
    After being busy with my main project it was great finally getting to come back to this asset and wow the update you guys have done are great can't wait to see more from you guys!
     
  3. Invector

    Invector

    Joined:
    Jun 23, 2015
    Posts:
    966
    Code (CSharp):
    1. using UnityEngine;
    2. using System.Collections;
    3. using Invector;
    4. #if UNITY_5_3
    5. using UnityEngine.SceneManagement;
    6. #endif
    7.  
    8. public class LoadSceneWhenDie : MonoBehaviour
    9. {
    10.     public string loadScene;
    11.     v_AIController ai;
    12.    
    13.     void Start ()
    14.     {
    15.         ai = GetComponent<v_AIController>();
    16.     }  
    17.    
    18.     void Update ()
    19.     {
    20.         if(ai.currentHealth <= 0)
    21.         {
    22.             // time must be before the AI destroy his components
    23.             Invoke("LoadScene", 2f);
    24.         }
    25.     }
    26.  
    27.     public void LoadScene()
    28.     {
    29.         #if UNITY_5_3
    30.         SceneManager.LoadScene(loadScene);
    31.         #else
    32.         Application.LoadLevel(loadScene);
    33.         #endif
    34.     }
    35. }
    36.  
    It's not a bug, you defend with the left hand and attack with the right hand just like dark souls, you can equip a attack weapon on the defense hand and you will defend, the difference is that DS uses LT and RT for heavy attacks and he can perform an attack, but LB will still defend and RB attack.
     
    abatcat likes this.
  4. Shadex

    Shadex

    Joined:
    Dec 18, 2013
    Posts:
    89
    No not yet. I have hope that Invector or Devdog will. I left a request on his forum. I got a ways till i'm ready to integrate it, but i would imagine you just use his equipment positional placer on the handler@weapon when you equip/unequip stuff.
     
  5. Shadex

    Shadex

    Joined:
    Dec 18, 2013
    Posts:
    89
    Having a bit of a problem. When i create enemy AI, and equip them with both a shield (with proper handlers, set to defence, Left Arm) and a sword (Right Hand, with proper handlers, movesets, etc) The sword disapears. When i disable the shield and hit play the sword works fine. What is happening is that the AI drops the weapon when i hit play. If i hit play with one of the weapons disabled, when i reenable that weapon during play, it also drops through the floor. I'm sure i'm missing something but haven't been able to figure it out.
     
  6. Invector

    Invector

    Joined:
    Jun 23, 2015
    Posts:
    966
    Make sure that you wrote the string "handler@weapon" at the weapon, otherwise it will never know who the handler is on the meleeManager and it will drop.
     
  7. Shadex

    Shadex

    Joined:
    Dec 18, 2013
    Posts:
    89
    I found a fix, i copied the vHeavyShield's defense component where the hitbox is, and pasted it on my newly created shield and for some reason it worked, despite the inability to set hitbox's to shields (or that im aware of).
     
  8. painkiller2007

    painkiller2007

    Joined:
    May 25, 2013
    Posts:
    44
    Well... there is still option of attacking with left hand weapon from the inspector menu! So, I thought if there is an option, then it makes sense to add that functionality ;) But anyways... thanks for clarification, its not that difficult to modify it suit those needs!

    Keep up the great work with the asset :)
     
    Invector likes this.
  9. xxhaissamxx

    xxhaissamxx

    Joined:
    Jan 12, 2015
    Posts:
    134
    what's new in 1.3b?
     
  10. Invector

    Invector

    Joined:
    Jun 23, 2015
    Posts:
    966
    http://www.invector.xyz/#!release-notes/eax8d

    Changelog v1.3b MELEE COMBAT SMALL UPDATE 15/05/2016
     
    kurotatsu and xxhaissamxx like this.
  11. kidling

    kidling

    Joined:
    Sep 8, 2015
    Posts:
    9
    hello invector, nice job with 1.3b.

    I have a doubt: what is the best way to add motion to a animation "in place"?

    i added a check in vThirdPersonAnimator.cs and i think is not a best way to do

    Code (CSharp):
    1.             if (baseLayerInfo.IsName("Grounded.Free Movement"))
    2.                 {
    3.                     var newSpeed = animator.GetFloat("Speed") * 5;
    4.                     Vector3 newPosition = transform.position;
    5.                     transform.position += transform.forward * (newSpeed * Time.fixedDeltaTime);
    6.  
    7.                 }
    I need to put a multiplier( 5 in this case) to get a correct motion in my sample.
     
  12. Invector

    Invector

    Joined:
    Jun 23, 2015
    Posts:
    966
    We already have a ExtraMoveSpeed for the free movement & strafe movement


    the method ExtraMoveSpeed() is called on the ThirdPersonAnimator,
     
    zenGarden likes this.
  13. kidling

    kidling

    Joined:
    Sep 8, 2015
    Posts:
    9
    Amazing, i didn´t see that. Thank you very much
     
    Invector likes this.
  14. TheEndersWAR

    TheEndersWAR

    Joined:
    Jan 8, 2015
    Posts:
    58
    @Invector You think you could create a 3rd person to 1st person view changer script similar to Ufps's one?
    Basically the script changes the Cameras location when pressing a button'', I'm asking this since i'm not a scripter :p
     
  15. Invector

    Invector

    Joined:
    Jun 23, 2015
    Posts:
    966
    We will make a partial 1st person, more like a Aim Zoom on the Shooter Template just like MGS:V does, but a full 1st Person view would required 1st person animations and a new controller to have decent results. It's not so simple to do it.

    @Carlos Rovira It took us way more work then I thought, but it's almost done!

    We are using IK to have this nice arms transitions without any animations, the only issue is that if you not check the rigidbody constrains x and z, the box can flip over lol, so maybe it's best to check those and use the box on a flat surface to avoid this issue, it really depends on your level design.



     
  16. TheEndersWAR

    TheEndersWAR

    Joined:
    Jan 8, 2015
    Posts:
    58
    Heres a script im using that gives me both third person and first person

    Code (CSharp):
    1. using UnityEngine;
    2. using System.Collections;
    3.  
    4. public class CamSwitchController : MonoBehaviour {
    5.  
    6.  
    7.     public Camera maincamera;
    8.     public Camera YellowCubeCamera;
    9.  
    10.  
    11.     private Camera[] cameras;
    12.     private int currentCameraIndex = 0;
    13.     private Camera currentCamera;
    14.  
    15.     // Use this for initialization
    16.     void Start()
    17.     {
    18.         cameras = new Camera[] { maincamera, YellowCubeCamera };//this is the array of cameras
    19.         currentCamera = maincamera; //When the program start the main camera is selected as the default camera
    20.         ChangeView();
    21.     }
    22.  
    23.     // Update is called once per frame
    24.     void Update()
    25.     {
    26.         if(Input.GetKeyDown("v"))
    27.         {
    28.             currentCameraIndex++;
    29.             if (currentCameraIndex > cameras.Length-1)
    30.                 currentCameraIndex = 0;
    31.             ChangeView();
    32.         }
    33.     }
    34.  
    35.     void ChangeView()
    36.     {
    37.         currentCamera.enabled = false;
    38.         currentCamera = cameras[currentCameraIndex];
    39.         currentCamera.enabled = true;
    40.     }
    41. }
     
    jayimagination likes this.
  17. TheEndersWAR

    TheEndersWAR

    Joined:
    Jan 8, 2015
    Posts:
    58
    I just want a way to make this script work better with the 3rd person controller plugin, Also this doesn't need no animations or nothing like that :)
     
  18. kidling

    kidling

    Joined:
    Sep 8, 2015
    Posts:
    9
    Invector, how hard is to implement a strong attack with Right trigger? i would love to see that.
     
  19. zenGarden

    zenGarden

    Joined:
    Mar 30, 2013
    Posts:
    4,538
    I am not sure it is a good idea to take so much directions ? The plugin is TPS.

    Nice.

    Does the plugin includes climbing and hanging over a ledge ?
    Will you have some video summarizing each plugin (locomotion, melee) features quickly to have a general view of what is included ?
     
    Malbers and Rusted_Games like this.
  20. Ludo97

    Ludo97

    Joined:
    Dec 9, 2015
    Posts:
    121
    Hello , how to add guns? thank you
     
  21. Rusted_Games

    Rusted_Games

    Joined:
    Aug 29, 2010
    Posts:
    135
    I agree with you, the more features the more braking changes and my fear is that it will start polluting the core of a Third Person Controller one of the main reasons I stepped away from Opsove´s TPC.
     
  22. indra-p

    indra-p

    Joined:
    Mar 12, 2013
    Posts:
    38
    i got a little issue with the v1.3b update...the player falling when steppingin into some areas... its not happen before the update.. how i can fix it?
     
  23. Invector

    Invector

    Joined:
    Jun 23, 2015
    Posts:
    966
    Cool, let me know if you manage to get nice results... the YellowCubeCamera has a script attached?

    I was just thinking about that! maybe we can set up the states and scripts to be ready for, and you guys just apply the animations :) - I will make some tests and let you guys know

    Well... you don't haha... at least for now this package is focus on Melee Combat, but we are already working on the Shooter Template ;)

    Check your Ground Layer, if the object has a different layer then it will not detect the collider as the ground and will keep falling.
     
  24. TheEndersWAR

    TheEndersWAR

    Joined:
    Jan 8, 2015
    Posts:
    58
    @Invector These are the steps I took to get it to work

    1. Make empty cameras null
    2. Parent the new Null folder to the head bone
    3. Position camera in front of head
    4. make the FP camera have a 0.01 clipping view
    5. Parent the camera under the New null object you made
    6. Drag the third person camera, and FP camera in there respective sections


    Bank!
     
    Last edited: May 23, 2016
    Alverik and jayimagination like this.
  25. TheEndersWAR

    TheEndersWAR

    Joined:
    Jan 8, 2015
    Posts:
    58
    The problem here is, well the camera shaking and the obvious problem of using 2 cameras, Theres also something weird with the 3rd person camera resetting (''dont think this script may have something to do with it'')
     
  26. indra-p

    indra-p

    Joined:
    Mar 12, 2013
    Posts:
    38
    everything is on the correct layer...the character can walk normally in the same object at some area but at some other area its falling... mostly its falling on area with sharp corner...like at the edge of a building as what i shown in the image above and also at the edge of a road...like this
    or this


    as i said before the issue is not happen in the older version(i made a backup project)...
     
    Last edited: May 22, 2016
    xxhaissamxx likes this.
  27. zenGarden

    zenGarden

    Joined:
    Mar 30, 2013
    Posts:
    4,538
    It could be some raycast issue, perhaps more character raycasts to ground could avoid it ?
     
  28. kidling

    kidling

    Joined:
    Sep 8, 2015
    Posts:
    9
    Invector, i got it working(its doing strong attacks with RT), but i think we need different damage in each attack.

    I think we need a option to put damage modifiers if the current attack is strong or normal. And could be a nice idea if combo attacks get different values too.
     
  29. Invector

    Invector

    Joined:
    Jun 23, 2015
    Posts:
    966
    The shacking is inevitable if you make the camera children of the head, the more the animation move, more the shake, for the camera, instead of disabling, you can increase the Depth value

    Very strange @indra p, I just test the demo scene here and the sters or any other sharp corner works just fine... test your demo scene and see if you can produce the same error, if the demo scene works, check your Grounded Setup values and compare to the v-bot, you can play with the Ground Check Distance too. Also, make sure that your gameObject has the same layer as your Ground Layer (Default)

    Nice idea indeed, we can provide that :)
     
  30. kidling

    kidling

    Joined:
    Sep 8, 2015
    Posts:
    9
    Sorry for disturb you, but i am really a newbie in unity/c#

    I tried to add a public variable at vThirdPersonMotor.cs with
    public bool strongAttack = false;

    I can access it in vThirdPersonController.cs with StrongAttack = true;

    But when i went to vMeleeManager and change the OnDamageHit function get that variable i got an error saying the name strongAttack don´t exist.

    How i can access global/public variables in vMeleeManager?
     
  31. Alverik

    Alverik

    Joined:
    Apr 15, 2016
    Posts:
    417
    Wow, that looks great! In fact I could even see the use of the boxes flipping over (player failing a puzzle, or player dropping heavy stuff from up high down to enemies heads,etc). Also it looks more realistic, unless, I guess, the player was really, really, very strong... (I think in here, the idea of "it's not an error, it's a feature!" might just work just fine. Or, it could be used as an optional approach, for those who want to use it that way).

    By the way, and pardon me, because I'm really new not only with the asset but with unity too... but, how would you get an effect of fast gliding (like for a character with wings or a jetpack)? I ask because I would like a character to use a fast gliding instead of sprinting.

    Anyways, any advice would be greatly appreciated.
     
    Last edited: May 23, 2016
    Invector likes this.
  32. indra-p

    indra-p

    Joined:
    Mar 12, 2013
    Posts:
    38
    my demo scene work just fine...i also tried to copy the character from the demo scene to my scene... the issue dont affect the demo's character..its mean the problem is with my character..


    then i copied the every "third person controller" values from the demo's character to my character... and the error still there...my character still falling on some area...
    im pretty sure the problem its not on the layer...
    it so frustating now....
    this is my character model : https://www.dropbox.com/s/e9kx4gvgykswfyo/hoodman.rar?dl=0
    i scaled it to 0.35 to fit the camera setting...maybe you can check that out and see what is the problem...
     
    Last edited: May 23, 2016
  33. xxhaissamxx

    xxhaissamxx

    Joined:
    Jan 12, 2015
    Posts:
    134
    when enemy in range and hit my player auto crouch how to solve it ? just disabled StartCoroutine("UpdateRaycast");
     
  34. kidling

    kidling

    Joined:
    Sep 8, 2015
    Posts:
    9
    got it Invector, i just need to declare it before the if

    var controle = FindObjectOfType<vThirdPersonMotor>();
    and controle.StrongAttack

    now is working as i dreamed with your amazing code :D.
    Strong attack give a random value of 1.3 to 2 multiplier above the normal one
     
    Invector likes this.
  35. Ludo97

    Ludo97

    Joined:
    Dec 9, 2015
    Posts:
    121
    Thank you for your reply. This is a very good asset for Unity really thank you !
     
    Invector likes this.
  36. Invector

    Invector

    Joined:
    Jun 23, 2015
    Posts:
    966
    Do you want your character to fly? or just move super fast? if you want your character to fly them you will need to have another type of movement, like: free, strafe & flying with another logic and another blendtree state to blend your flying animations... if you want just to increase the speed, them increase the Extre Move Speed value on the inspector.

    @indra p Your character was very big and the character creator window has not able to figure out the correct size/pos of the capsule collider, you probable manually adjust and maybe the bottom of the capsule was not fully touching the ground. I opened your model on maya and fix the size, them I re-rig on Mixamos and it's working much better now:
    [Download]





    Check your Layers, I think there is some object with the Layer Default on your enemy or your weapon that is making the character crouching.
     
    indra-p, Alverik and xxhaissamxx like this.
  37. supneo

    supneo

    Joined:
    Jul 29, 2012
    Posts:
    32
    Hi @Invector , if you create Companion AI in new fbx model ( not prefab ) and change tags to detect to Enemy and pres play automatically Enemy change to player and companion attack player , is this a bug?

    Creating companion and save prefab works correct.
     
  38. Alverik

    Alverik

    Joined:
    Apr 15, 2016
    Posts:
    417
    Hi, basically I want to do what they did in Okami, where the player has 3 move speeds: walk, run, and if you run long enough you get an auto dash with cool particles and all, but instead of the character just running faster in the dash, I want my character to hover/glide over the ground. there's probably going to be some scenes with actual flying around though.
     
  39. xxhaissamxx

    xxhaissamxx

    Joined:
    Jan 12, 2015
    Posts:
    134
    AI doesn't look to me after attacking

    and when he attack that's happen
     
  40. snackzilla

    snackzilla

    Joined:
    Aug 17, 2014
    Posts:
    91
    Hello again Invector! I have another quick scripting question! How would I disable ONLY player control at runtime? I'm integrating Inventory Pro, and they have their own method to disable player control, but it seems overly complicated. I'm looking for a method to call when a GUI menu is up. I could disable the player as a whole, and re-enable it when the menu goes away, but I've got a Render Texture camera on the player so the user can visually see what's equipped. I'll upload a video later to show you guys what I've got.
     
  41. Invector

    Invector

    Joined:
    Jun 23, 2015
    Posts:
    966
    Strange I just test here and the tag doens't change to Player, are you using v1.3b?
    AI Controller > Tags to Detect: is who you can see and chase
    Melee Manager > Hit Damage Tags: is who you can attack

    Well in this case I believe you just need to change the sprint animation to your hover/glide animation isn't?

    Yeah I notice that too, but I this only happen on small spaces such as over this cube - We will take a look into this issue

    You can simple disable the ThirdPersonController script or we also have a bool call LockPlayer, it will lock all input.
    For example:

    Code (CSharp):
    1. using UnityEngine;
    2. using System.Collections;
    3. using Invector;
    4.  
    5. public class LockPlayer : MonoBehaviour
    6. {
    7.     public bool lockPlayer = false;
    8.  
    9.     void Update ()
    10.     {
    11.         Invector.CharacterController.vThirdPersonController.instance.lockPlayer = lockPlayer;
    12.     }
    13. }
    14.  
     
    kurotatsu likes this.
  42. Rose-Remnant

    Rose-Remnant

    Joined:
    Nov 14, 2012
    Posts:
    123
    I am going to make a gauntlet run using the UMenu Pro asset, it provides a nice menu setup, my goal is to set up a gauntlet run, adventure mode and adventure mode with many difficulties
     
  43. Rose-Remnant

    Rose-Remnant

    Joined:
    Nov 14, 2012
    Posts:
    123
    o_O where you going bro, lmao just messing around literally just attached the companion script and pressed play.

     
  44. snackzilla

    snackzilla

    Joined:
    Aug 17, 2014
    Posts:
    91
    That worked absolutely brilliantly. Thank you again!
     
    Invector likes this.
  45. Invector

    Invector

    Joined:
    Jun 23, 2015
    Posts:
    966
    Try using the Character Creator window instead of attaching the scripts, also take a look into the video tutorial
     
  46. Malbers

    Malbers

    Joined:
    Aug 7, 2015
    Posts:
    2,558
    Hi Invector, thanks for all, and for you guys who use Horse Animset Pro and Invector is the tutorial for the new release.

    Cheers
    Malbers
     
  47. Rose-Remnant

    Rose-Remnant

    Joined:
    Nov 14, 2012
    Posts:
    123
    yep will do, was just amazing how fast it is to get something working
     
    Invector likes this.
  48. kurotatsu

    kurotatsu

    Joined:
    May 10, 2012
    Posts:
    588
    I love this the only thing missing is the reins being IK'd to his hands.

    Well Done.
     
    Malbers likes this.
  49. magique

    magique

    Joined:
    May 2, 2014
    Posts:
    4,030
    I'm thinking of getting this and will probably use FinalIK to do the reins. That should be possible.
     
    Malbers likes this.
  50. Malbers

    Malbers

    Joined:
    Aug 7, 2015
    Posts:
    2,558
    There's a horse with dynamic rein, and hair, using unity cloth, but IK reins to the hands are added to the next features list. ;)
     
    kurotatsu likes this.