Search Unity

  1. Good news ✨ We have more Unite Now videos available for you to watch on-demand! Come check them out and ask our experts any questions!
    Dismiss Notice

Third person cover controller

Discussion in 'Assets and Asset Store' started by EduardasFunka, May 23, 2017.

  1. EduardasFunka

    EduardasFunka

    Joined:
    Oct 23, 2012
    Posts:
    462
    That's a good critique I think we can patch those before 1.7

    Thanks
     
  2. EduardasFunka

    EduardasFunka

    Joined:
    Oct 23, 2012
    Posts:
    462
  3. Rahd

    Rahd

    Joined:
    May 30, 2014
    Posts:
    323
    thank you , not good as the melee surprise you just dropped , no site so far (money issues :()
    Hi everyone,
    really sorry for not answering or posting anything , due to health problems , this forum means something to me :)
    and again really sorry for the melee AI , but our best dev EduardasFunka saved the day with the melee progress .
    i will migrate the ,monster AI to pure cover shooter code so everyone can use it
    and to make it up for you guys :
    CARS ,

    soon

    Tanks
    Bikes
    ladders and cliff climbing ( like with a hook and a rope script )
    Boats
    you can start by adding cars with https://forum.unity.com/threads/randomation-vehicle-physics-2-0-now-open-source-on-github.310487/
    this is an opensource pluging for cars , with alot of profiles , for trucks , RCar, 4 doors .. bus
    with everything from deform or lose parts on impact , transition ... engine ..
    easy to setup just focus on the wheels rotation when doing so .


    and adding this to the mobile controller
    public RVP.VehicleParent car;
    public bool isincar;

    under update / if (hasMovement)
    if (!isincar) {
    // here you put the old script for the on foot movement


    } else {

    var y = Movement.y;
    var x = Movement.x;


    car.SetAccel(y);


    car.SetSteer(x);

    that's all , just put the car script in the mobile controller and make a button that will make the player inside the car
    and set isincar = true

    i will add more like riding animation , and will look into the horse more ...
    tanks , boats , cars , bikes , can use the same script as that one or directional

    so far i need to fix the mobile controls so it will be based on the car direction
    EduardasFunka please help .

    for boats : https://github.com/eliasts/Ocean_Community_Next_Gen
    yes it works on my old note (60FPS all the time make use of this super water and boat system )

    so feel free to ask me anything , i will be doing it for free if it works. chris gave me a good idea about ladder climb
    i'm working on that and a grappling hook like in ark and cliff climb (with stamina as a a limit just like conan exiles)
    just made him transfer without any animation inside the horse prefab there is a gameobject called rider mount , something like that . so when you press the button to ride i change the parent to the rider mount gameobject , when he is done with the horse , i set the parent to nothing. , more work on the aim animations and maybe the riding

    i will resub to the patreon(sorry broke this month) , and i will try to make a community github (!! only for paying users lol and it's up to EduardasFunka really this is his baby) . or if EduardasFunka does that it will be super . i think this will help to kill all bugs , and make this the best asset , Ocean_Community_Next_Gen and randomation-vehicle-physics-2 are that good because everyone helped to make it better .

    last thing : this is by far the most compatible shooting AI i have found , sure it has some tiny problems , but is not complicated , as you can see 4-6 lines of code and you have a car in your game ...
     
    Last edited: Sep 6, 2018
  4. Rahd

    Rahd

    Joined:
    May 30, 2014
    Posts:
    323
    right on point with this yeah , this was most of the problems i have faced
    so i will try to help with some :
    1-capsule size try to switch the Axies to y . x . z one of them will work
    i hade this problem with laying on the floor .
    2- you can add a delay in the fire func on the gun.cs script
    3- ignoreraycastlayer : i had this problem with the bullet ricochet so the default Ignoreraycast layer will fix that .
    4-yes however you can set the target on the AI motor to null : example you test if target health <0 or isdead
    target = null , and you can even change the AI status and set a waypoint for him to go back
    5- correct i will skip this , i had to buy and make the effects
    6- i think i have shared the death ragdoll code ,
    that will take the damage of the gun and apply a force on it
    so a pistol will blow the dead ai on death and a rocket or a 50cal will send him flying , and you can put weight on the ragdoll creation , so bigger monster or shooter will not fly as much .
    i have an update script that works better , but i still recommend a separate plugin like Ragdoll - Hit Reaction Manager if for FPS , and your own cheap ragdoll if for mobile
    please let me know if you need the code again , cheers
     
    Last edited: Sep 6, 2018
    EduardasFunka likes this.
  5. GWStudio

    GWStudio

    Joined:
    Sep 27, 2016
    Posts:
    109
    hi everyone >> i am try to achieve first person shooter with this controller because it have an awesome AI so is there is any way to do first person camera ??!! or integrate cover controller AI with Invector third person shooter template
     
  6. EduardasFunka

    EduardasFunka

    Joined:
    Oct 23, 2012
    Posts:
    462
    First enable Always aim. Third person camera has states, You can change where camera should be in every state. It will not be perfect you need to code to make it perfect.

    FPS_LOL.gif

    Maybe we will make Fps mode someday. It would be a fun challenge for us.
     
    GWStudio likes this.
  7. EduardasFunka

    EduardasFunka

    Joined:
    Oct 23, 2012
    Posts:
    462
    Community update
     
    Jerome_V, Pollawat, redoxoder and 2 others like this.
  8. GWStudio

    GWStudio

    Joined:
    Sep 27, 2016
    Posts:
    109
    I hope u make it in the next update it will be great to play this controller with FPS view :rolleyes:
     
  9. o0neza0o

    o0neza0o

    Joined:
    Sep 6, 2015
    Posts:
    164
    Are we able to add in creatures with a generic rig? or is this at a later date?
     
  10. EduardasFunka

    EduardasFunka

    Joined:
    Oct 23, 2012
    Posts:
    462
    I have not tested but it shuld be posible. Will make zombies for sure soon
     
  11. o0neza0o

    o0neza0o

    Joined:
    Sep 6, 2015
    Posts:
    164
    I meant spiders and things cause i want the creatures to be somewhat special
     
  12. p_hergott

    p_hergott

    Joined:
    May 7, 2018
    Posts:
    385
     
  13. p_hergott

    p_hergott

    Joined:
    May 7, 2018
    Posts:
    385
    Thats awsome. So, this controller does do animals then eh? Ive always bypassed this controller because it looked like a basic shooter, but today i thought i would actually look into it, and just Fn wow. Im thinking a lil more swords and bows though. But i need human npcs and animal npcs
     
  14. Rahd

    Rahd

    Joined:
    May 30, 2014
    Posts:
    323
    no no no dude , that's something else it's not this assets ,sorry for the confusion .
    but the new update 1.6 will do that and better , since it has a real AI with raycast . the one i made use colliders , mine is not very good .
    melee will be added soon on this assets , and should be better
     
  15. p_hergott

    p_hergott

    Joined:
    May 7, 2018
    Posts:
    385
    upload_2018-9-8_20-40-11.png
    oh geez, I cant even get the demo scene to run right ….
     
  16. p_hergott

    p_hergott

    Joined:
    May 7, 2018
    Posts:
    385
    So in this video, you intergrated milkid? Was it hard? Does the tpcc intergrate easy with other assets? Like emerald ai or ai designer pro?
     
  17. Sarhanbh

    Sarhanbh

    Joined:
    Apr 15, 2015
    Posts:
    44
    I have some suggestions I would like to find in upcoming updates or if that possible in this time you can tell me.
    first sorry my english not good.

    in each state that enemy turn it, i need to do some actions like play audio. for example when enemy see the player. I want play radio audio, and view some UI's on the enemy, that will tell the player the enemy found him and this will increase my game UX value, I see this features in some games (like hitman, when enemy search about player, the circle icon view on the enemy, and if they found him the circle convert to red color) anyway, i wan't just call my own code/method.
    when i see your fight brain cs. I see (event part) so i think my suggestion easy :)

    also,
    when the enemy sight the player, (like most of current games) I don't enemy see him directly and attack! but
    The enemy turns into a focus on the player, with a variable increased based on the distance. If the player disappears enemy search for him, if the variable search to final value; starts to attack him, I also want to show some UI as in most games like the division, ghost reacon, and so on!
     
  18. p_hergott

    p_hergott

    Joined:
    May 7, 2018
    Posts:
    385
    Anyone have a link to a method for inventory pro intergration?
     
  19. p_hergott

    p_hergott

    Joined:
    May 7, 2018
    Posts:
    385
    this may be an odd question, but im hoping an easy one. can I put the terrain on a different layer? I created a layer, called ground and set the terrain to it, but then cowboy cant collide with it, he just floats in the air.
     
  20. EduardasFunka

    EduardasFunka

    Joined:
    Oct 23, 2012
    Posts:
    462
    Most of the stuff planned for future updates. 1.7 Will have better control for AI.
    UI and inventory probably next year.
     
  21. EduardasFunka

    EduardasFunka

    Joined:
    Oct 23, 2012
    Posts:
    462
    Support by email
     
  22. EduardasFunka

    EduardasFunka

    Joined:
    Oct 23, 2012
    Posts:
    462
    The Character Motor expects ground and level geometry to be found in first layer, We recognise this isn't convenient to everyone and therefore it will be improved.
     
  23. Pollawat

    Pollawat

    Joined:
    Aug 27, 2016
    Posts:
    173
    Hello sir, I have a question about to set AI behavior flawless like in the prototype scene?



    As you can see in the video the same character in the custom scene work very badly, they stuck, they don't search for some reasons. In the prototype scene, all of the AI search every corner of the scene and it look very nice. There are any significant setting that makes it work like that?
     
  24. EduardasFunka

    EduardasFunka

    Joined:
    Oct 23, 2012
    Posts:
    462
    Increase view range. Bake navmesh. Turn on debug on AI search to test if AI can see covers
     
  25. Rahd

    Rahd

    Joined:
    May 30, 2014
    Posts:
    323
    hi ,did anyone made a port to A* pathfinding or apex path ?
    i think unity navmesh is the cause of all the bugs !!
     
  26. Pollawat

    Pollawat

    Joined:
    Aug 27, 2016
    Posts:
    173
    Hello, again sir. I try to make the exact same scene by copying the setting from your prototype scene. I don't understand why some time AI do the behavior like this.


    As you can see the weird walk try to find cover but not using it. Any suggestion sir?
     
  27. EduardasFunka

    EduardasFunka

    Joined:
    Oct 23, 2012
    Posts:
    462
    I do not understand from video send us your project then.
     
    Pollawat likes this.
  28. Pollawat

    Pollawat

    Joined:
    Aug 27, 2016
    Posts:
    173
    Well, thank you for your attention. Anyway, the problem seems to happen randomly, I'm analyzing it for a while and if I found something connects to your script I will do what your suggesting. I mean the project it almost 70Gb so... yeah very hard to pack and send. I need more time. lol
     
  29. Testmobile

    Testmobile

    Joined:
    Jul 3, 2012
    Posts:
    98
    Thank you sir! Hope you get better ASAP!
     
    Rahd likes this.
  30. NwSource

    NwSource

    Joined:
    Jul 19, 2015
    Posts:
    1
    I
    I dont know if its the cause of this problem but i have found a "bug" today [at least for me its a bug]. If Im wrong pls forgive me. AIUtil class -> Path method third parameter[vector3 target] needs to pass as a refrence, movement system still sees old target value and it never goes to destination. So It creates some glitch. It generally happens if baked navmesh's player radius is too high. [Ps: version 1.4]

    I've also figured that, AIFire script does not check guns auto reload field when sending inputreload to the motor. [It might be a design decision, its just not worked for me.]
     
    Last edited: Sep 16, 2018
  31. Testmobile

    Testmobile

    Joined:
    Jul 3, 2012
    Posts:
    98
    I finally managed to get this vehicle thing going.
    i still have to figure out the enemy interaction and some way to make em ragdolls when i hit them.
     
    Neviah and EduardasFunka like this.
  32. EduardasFunka

    EduardasFunka

    Joined:
    Oct 23, 2012
    Posts:
    462
    Nice stuff could you make a tutorial for the community?
     
    Testmobile likes this.
  33. umair21

    umair21

    Joined:
    Mar 4, 2016
    Posts:
    108
    Hi, I am facing a problem in walking onto slopes. My character can walk only on some slopes with certain angle. I want to know how can I change the slope limit so that my character could walk on any slope that I want. Please HELP.


    Can walk on this slope
    Can walk slope.PNG


    Cannot walk on this slope.
    Cannot walk slope.PNG
     
  34. Rahd

    Rahd

    Joined:
    May 30, 2014
    Posts:
    323
    if player :
    ground threshold , fall threshold and /or threshold on CharacterPlatform
    if for AI try baking with a larger slop angle .
     
  35. AnthonyMyers

    AnthonyMyers

    Joined:
    Jul 25, 2014
    Posts:
    28
    Im having the same issue also. I was going to post this same issue and I've tried to change the bake angle and its still not working.
     
  36. umair21

    umair21

    Joined:
    Mar 4, 2016
    Posts:
    108
    It didn't work. I tried to change Ground Threshold, Fall Threshold from Character Motor Script and Threshold from Character Platform script but none of them work either.
     
  37. p_hergott

    p_hergott

    Joined:
    May 7, 2018
    Posts:
    385
    If the larger slope in part of the nav mesh? And nav mesh settings?
     
  38. umair21

    umair21

    Joined:
    Mar 4, 2016
    Posts:
    108
    I am talking about Player, Player doesn't need nav mesh to move.
     
  39. EduardasFunka

    EduardasFunka

    Joined:
    Oct 23, 2012
    Posts:
    462
    We testing it now there is no one parameter to change that there are many... will update
     
  40. umair21

    umair21

    Joined:
    Mar 4, 2016
    Posts:
    108
    Alright. Waiting.....! :)
     
  41. EduardasFunka

    EduardasFunka

    Joined:
    Oct 23, 2012
    Posts:
    462
    Walking on slopes is a combination of velocity, gravity, capsule size and other properties.
    We fixed a bug where even with right settings the character wouldn't climb as they'd think the cliff is a wall. The fix was simply raising the ray by 10cm that checks for obstacles in front of the character.
    We are adding a new property to the CharacterMotor, MaxSlope. The velocity is scaled to zero when climbing, otherwise the character would run up the hill at the same speed as running on a flat plane. MaxSlope is the point where velocity reaches zero.
    However, it might not be possible to reach high values of MaxSlope as the character capsule at a certain point stops touching the ground with its base. Such situation is controlled with GroundThreshold. Increasing it increases the maximum allowed heigh between the ground and the capsule.
     
    Rahd likes this.
  42. umair21

    umair21

    Joined:
    Mar 4, 2016
    Posts:
    108
    Can you tell me from where I can raise the ray by 10 cm?
     
  43. EduardasFunka

    EduardasFunka

    Joined:
    Oct 23, 2012
    Posts:
    462
  44. AnthonyMyers

    AnthonyMyers

    Joined:
    Jul 25, 2014
    Posts:
    28
    Can I get a fix for this now or can you show a work around?
     
  45. EduardasFunka

    EduardasFunka

    Joined:
    Oct 23, 2012
    Posts:
    462
    1.6 coming to the store near you.
     
    Prefab, redoxoder, Rahd and 2 others like this.
  46. Testmobile

    Testmobile

    Joined:
    Jul 3, 2012
    Posts:
    98
    Looks fantastic!


    Sure thing!
    You guys have to remember that im not very bright on code so it isn't really my thing, it's an abstraction, perhaps we could all improve it as we go.

    Right now i still haven't figured out how i will detect the car so im dragging manually the vehicle system into the third person input car variable and set "hasCar" as true.

    I also created a new layer (layer 13) that is set on the physics manager to not collide with the car colliders.
    Here are the things that has to be changed on the ThirdPersonInput.cs

    Code (CSharp):
    1.  public class ThirdPersonInput : MonoBehaviour
    2.     {
    3.  
    4.  
    5.         //code changes to add rcc car
    6.         Animator _animator;
    7.         public VehicleSystem car;
    8.         public bool hasCar;
    9.         public bool isInCar;
    10.         public bool isDriver;
    11.         bool inside;
    12.         public GameObject mainCamera;
    13.         public GameObject carCamera;
    14.      
    15.  
    16.         IEnumerator EnterCar() {
    17.             gameObject.layer = 13;
    18.          
    19.             _animator.SetBool("InCar", true);
    20.             _motor.isInCar = true;
    21.             gameObject.transform.parent = car.driverPos.transform;
    22.          
    23.             yield return new WaitForSeconds(3);
    24.             isInCar = true;
    25.             gameObject.transform.rotation = car.driverPos.rotation;
    26.             carCamera.SetActive(true);
    27.  
    28.             mainCamera.SetActive(false);
    29.             if (isDriver) { car.carCTRL.canControl = true; }
    30.             inside = true;
    31.             Debug.Log("test");
    32.         }
    33.  
    34.  
    35.         IEnumerator ExitCar()
    36.         {
    37.             _animator.SetBool("InCar", false);
    38.          
    39.             carCamera.SetActive(false);
    40.             mainCamera.SetActive(true);
    41.  
    42.             if (isDriver) { car.carCTRL.canControl = false; }
    43.             gameObject.transform.parent = null;
    44.             gameObject.transform.position = car.driverDoor.transform.position;
    45.             _motor.isInCar = false;
    46.             yield return new WaitForSeconds(3);
    47.             gameObject.layer = 10;
    48.             isInCar = false;
    49.             inside = false;
    50.  
    51.  
    52.             Debug.Log("test");
    53.         }
    54.  
    55.  
    56. private void Awake()
    57.         {
    58. if (mainCamera == null) { mainCamera = GameObject.FindGameObjectWithTag("MainCamera");
    59. if (mainCamera == null) return;
    60. }
    61.             if (carCamera == null) { carCamera = GameObject.FindGameObjectWithTag("CarCam");
    62. if (carCamera == null) return;
    63.                         carCamera.SetActive(false); }
    64. }
    65. private void Update()
    66.         {
    67. if (hasCar && Input.GetKeyDown("k"))
    68.             {
    69.                 if (isInCar) {
    70.                     StartCoroutine(ExitCar());
    71.                 }
    72.                 else
    73.                 {//moving character to car
    74.                     if (!inside)
    75.                     {
    76.                         StartCoroutine(EnterCar());
    77.                     }
    78.  
    79.                 }
    80.  
    81.             }
    82. }
    83.  
    84. protected virtual void UpdateMovement()
    85.         {
    86.             if (!isInCar)
    87.             {  // here goes the original code from this function
    88.  
    89. }
    90.   else
    91.             {
    92.                 gameObject.transform.position = car.driverPos.transform.position;
    93.                  gameObject.transform.rotation = car.driverPos.transform.rotation;
    94.             }
    95. }
    96.  
    97.  
    98.  
    CharacterMotor.cs has to be changed aswell

    Code (CSharp):
    1. public class CharacterMotor : MonoBehaviour
    2.     {
    3.   public bool isInCar;
    4.  
    5.  
    6.   private void LateUpdate()
    7.         {
    8.             if (!isInCar)
    9.             {//Insert here the original code from this function
    10.  
    11. }
    12.  
    13. private void updateAngles()
    14.         {
    15.             if (!isInCar)
    16.             {//insert the original code here}
    17. else { _horizontalAngle = 0;
    18.                 _verticalAngle = 0;
    19.             }
    20.           }
    21.  
    22.  
    23.  
    24.  
    You will need an extra script to attach to your vehicle to inform the third person input things about your vehicle(in the future it will include health, passenger seats, control the door animation and stuff)
    Code (CSharp):
    1. public class VehicleSystem : MonoBehaviour {
    2.     public Transform driverPos;
    3.     public Transform driverDoor;
    4.     public RCC_CarControllerV3 carCTRL;      //Im using realistic car controller so what goes on here depends on what you have.
     
    Paul-Swanson, Rahd and EduardasFunka like this.
  47. redoxoder

    redoxoder

    Joined:
    May 11, 2013
    Posts:
    73
    so 1.6 is send to the store ??? so 5 or 7 days to see it ??
     
  48. imump

    imump

    Joined:
    Jul 3, 2011
    Posts:
    53
    Is ricochet of projectiles implemented at all?
     
  49. EduardasFunka

    EduardasFunka

    Joined:
    Oct 23, 2012
    Posts:
    462
    Yes, it was sent to the store if you want sooner send me an invoice number. Or subscribe to our patron and get daily updates. Patreon guys had melee for weeks now... Plus you will support devs that make your game with you.
     
  50. EduardasFunka

    EduardasFunka

    Joined:
    Oct 23, 2012
    Posts:
    462
    we have a basic feature you can see in the video. Its more of what kind particles you want in your specific game so its more of an artistic problem.
     
unityunity