Search Unity

Third person cover controller

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

  1. raikoification

    raikoification

    Joined:
    Apr 13, 2019
    Posts:
    4
    Hi, i'm having troubles with one of my character's animation. All the other animations look perfectly fine aside from the *aiming* animations (reload, sprint, gun lowered, etc.. all are working fine). I suspect it has something to do with the aim bone as changing its rotations will re-position the arm but will also screw up the aim bones location as the bullets are suppose to come out of that bone i believe, not to mention no matter how much i played around with the XYZ i could not properly position the hands to direct the gun.

    You can see here that the hand is pointing straight left when it should be pointing forward (if i map the aim bone it points straight right)

    If anyone knows how to fix this issue please let me know!

    -edit-
    Turning off IK on the character motor also fixes it but i cant shoot anymore and IK doesnt work anymore



    For reference, this is how it should look

     
    Last edited: Apr 16, 2019
  2. SnowblindFatal

    SnowblindFatal

    Joined:
    Jun 9, 2014
    Posts:
    20
    To further add to my previous issue: I also tried using .NET Framework v. 3.5 on both the 2018 version as well as the new 2019 version. There is, regardless, a multitude of errors. I suppose there was some kind of accident with this release?
     
  3. MastermindInteractive

    MastermindInteractive

    Joined:
    Jun 13, 2014
    Posts:
    86
    1) Confirm your character is a Humanoid
    2) Configure your Humanoid rig in the model's Inspector > Rig and select "Force T Pose" from the "Pose" dropdown at the bottom right.

    See if that works...
     
    redoxoder likes this.
  4. raikoification

    raikoification

    Joined:
    Apr 13, 2019
    Posts:
    4
    It did not fix the problem
     
    Last edited: Apr 17, 2019
  5. nearearthsports

    nearearthsports

    Joined:
    May 28, 2018
    Posts:
    4
    I got your asset for making some mobile games but I don't want to make mobile top down shooter. setting up camera is pretty difficult for top down, can you please explain how to do that.
     
  6. MastermindInteractive

    MastermindInteractive

    Joined:
    Jun 13, 2014
    Posts:
    86
    Look a few pages back in this forum and there is a video explaining it.
     
    redoxoder likes this.
  7. Rahd

    Rahd

    Joined:
    May 30, 2014
    Posts:
    270
    i used the third person input for some functions like jump , i dropped the whole thing and made the ones i need by hand .
    the cf2 tuto should cover everything and it will only works with third person
     
    redoxoder, Moe-Mogare and Lay84 like this.
  8. Moe-Mogare

    Moe-Mogare

    Joined:
    Apr 16, 2015
    Posts:
    14
    I was wondering can you please make a tutorial on how to use Horse animset with this engine it would truly help me out, I'm working on a 3rd person western shooter
     
  9. nearearthsports

    nearearthsports

    Joined:
    May 28, 2018
    Posts:
    4
    Such an amazing tutorial, I have one question, how to convert camera to third person for mobile instead of top down. I am banging my head to wall but unable to do this.
    I need auto aim functionality but with third person controller. How can I Achieve this please help.
     
    satchell likes this.
  10. nearearthsports

    nearearthsports

    Joined:
    May 28, 2018
    Posts:
    4
    Is there anyway we can implement third person camera for mobile not top down but with same aim assist functionality?
    if there is it'll be so awesome to get some help to make this feature work for me.
     
  11. raikoification

    raikoification

    Joined:
    Apr 13, 2019
    Posts:
    4
    anyone have a possible fix for this?
     
  12. EduardasFunka

    EduardasFunka

    Joined:
    Oct 23, 2012
    Posts:
    461
    It looks like you need setup gun for both hands left and right. If it does not help send me your model.
     
  13. Rahd

    Rahd

    Joined:
    May 30, 2014
    Posts:
    270
    i really can't those days due to health problems , however
    you just need to feed the x/y movements from the motor to the horse script it's really easy
    the hard part is the animation for riding the horse and the aim .
    you can get around that by coping the rider script code into the motor script and adding the animations of the horse pro animator (rider) as a new layer of the cover shooter animator .
    really sorry for the lack of help .
    good luck
     
    redoxoder, Moe-Mogare and satchell like this.
  14. Sarhanbh

    Sarhanbh

    Joined:
    Apr 15, 2015
    Posts:
    41
    hi there, i try to use (alert) script on door when it open i call (Activate) for it
    i set an enemy near to it, with 20 range for alert (enemy have listener with 1 value)

    anyway, when player open the door, the enemy don't change state (Idle) !!

    is that mean i make some mistake with alert script? how i implement my idea?
     
  15. satchell

    satchell

    Joined:
    Jul 2, 2014
    Posts:
    82
    Not 100% sure but try changing the tag to "Player" on the door GameObject.
     
  16. Sarhanbh

    Sarhanbh

    Joined:
    Apr 15, 2015
    Posts:
    41
    thanks for answer
    i change door tag to player
    but nothing is change!
    ok it not very important i will try with it later
    i face new strange problem

    i follow AI Spawn tutorial, (with different video is very old without inventory script!)
    anyway, the ai spawn not work! enemy don't call to spawn his friends... i sure i make like tutorial (with one different is inventory script that was not in tutorial!)
     
    satchell likes this.
  17. Sarhanbh

    Sarhanbh

    Joined:
    Apr 15, 2015
    Posts:
    41
    third comment about some bugs sorry about that :|

    anyway the problem is that the enemy don't see the player in some times, i mean it is a bug.
    - first i shot in my position (In the Upper floor) enemy listen that and see the player, then they try to come in upper floor.
    - in this time i go to in and Sit at the stairs that enemy will come from here, i set in other left side.
    - the problem is the enemy come ti the stairs and look on player position that they should not look there because there are a wall, they should look on up of stairs untill reach to up then look on player position.
    - from this problem, enemy don't see me while i set in the same stairs but in left side (they look on right side, so i behind them)

    enemy (e) come from down to up, and look the wall (police)

    upload_2019-4-25_17-56-32.png

    my old position (that enemy look on it know but there are a wall so should don't look on it) is blue color
    and the enem old position is black color
    upload_2019-4-25_17-58-41.png
     
  18. Lay84

    Lay84

    Joined:
    Mar 8, 2014
    Posts:
    32
    hey Guys (and Gals), anyone have success implementing the roll function on the mobile controller (top down View). Roll method from the third person input/controller (TPC) works on input but it does not roll in the direction the player is facing. This is the code i experimented with, its only slightly modified from the TPC:

    MODIFIED in the Thirdpersoninput script*********

    protected virtual void UpdateRolling()
    {

    if (ControlFreak2.CF2Input.GetButtonDown("RollForward"))
    {
    var cover = _motor.GetClimbambleInDirection(aimAngle);
    if (cover != null)
    _controller.InputClimbOrVault(cover);
    else
    roll(Vector3.forward);
    }

    }

    private void roll(Vector3 local)
    {
    var direction = getMovementDirection(local);
    if (direction.sqrMagnitude > float.Epsilon)
    _controller.InputRoll(Util.HorizontalAngle(direction));
    }


    I removed the double taps of the WASD keys and tried to make only one roll in the facing direction. but its not working right. this is also under the Third person input script using control freak for touch input. I figured if I got it working properly I could implement it in the mobile controller but i think the logic is diff due to the camera.

    To be clear I am trying to create input function that will cause player to roll in the direction the movement joystick is facing on mobile controller. any help would be appreciated clearly I am not a programmer by trade so forgive if this is a simple solution, Thanks!
     
  19. Lay84

    Lay84

    Joined:
    Mar 8, 2014
    Posts:
    32
    figured it out with a bit of reverse engineering. After seeing how the Roll funtion on the third person controller converted the moving direction into an angle, i was able to get it working on the mobile controller.
     
    satchell likes this.
  20. MastermindInteractive

    MastermindInteractive

    Joined:
    Jun 13, 2014
    Posts:
    86
    @EduardasFunka - I found an issue in the ThirdPersonInput.cs - When you are in cover and you rotate the camera to face the same direction as the cover object / move along the cover. right now it moves the character the opposite of the direction you want it to go. So if you press forward, it will go backward, and if you press back it will go forward. This makes it really difficult to enter and leave cover and control the character when you are doing anything other than looking at the character straight on.

    Here is the fix...

    Before...

    Code (CSharp):
    1.                 if (_motor.Cover.IsLeft(angle, 45))
    2.                     angle = Util.HorizontalAngle(_motor.Cover.Left);
    3.                 else if (_motor.Cover.IsRight(angle, 45))
    4.                     angle = Util.HorizontalAngle(_motor.Cover.Right);
    After...

    Code (CSharp):
    1.                 if (_motor.Cover.IsLeft(angle, 45))
    2.                     angle = Util.HorizontalAngle(_motor.Cover.Right);
    3.                 else if (_motor.Cover.IsRight(angle, 45))
    4.                     angle = Util.HorizontalAngle(_motor.Cover.Left);
    By swaping the _motor.Cover.Right and _motor.Cover.Left angles it makes it so that moving forward along a cover will make you move forward and moving backward will make you move back instead of the opposite. It also make it easier to leave cover.
     
    redoxoder and Lay84 like this.
  21. MastermindInteractive

    MastermindInteractive

    Joined:
    Jun 13, 2014
    Posts:
    86
    @EduardasFunka - is it possible to make the AI take turns firing at an enemy if they are in the same team? Right now all of the enemies fire at the same time which makes it a really unfair fight. Most AI in games make the enemies take turns if they are in the vicinity of a teammate. Think Of the Rocksteady Batman games.
     
    Rahd, redoxoder and Lay84 like this.
  22. EduardasFunka

    EduardasFunka

    Joined:
    Oct 23, 2012
    Posts:
    461
    Current AI you can play with burst fire and give different parameters. Create different types "sniper" "rusher" etc. but that's it. With new AI you will have more options. You can scan how many teammates AI have and increase wait time before shooting, decrease accuracy. If you have some specific suggestion on how to do those "turns" that would be great.

    Preview of AI brain. There are lots of possibilities to customize behavior.
    upload_2019-4-29_9-14-20.png
     
    io1, Hamesh81, TeagansDad and 2 others like this.
  23. redoxoder

    redoxoder

    Joined:
    May 11, 2013
    Posts:
    66
    looks greet ...can't wait ..lol
    a release for ????….thanks
     
  24. MastermindInteractive

    MastermindInteractive

    Joined:
    Jun 13, 2014
    Posts:
    86
    I’m not sure how you are coding this in order to make suggestions, or even what type of AI techniques you are employing. My thought is that if the enemies are all engaged and have scanned that they are in the same fight with the same enemy they could randomly take turns shooting a burst. So give them an amount of time to wait to check if it is their turn, if no one is shooting and they don’t need to reload then shoot. Then reset that timer to wait. This will give other enemies time to shoot. This may require a manager outside of the enemies to keep track of who has shot and when or whose turn it is so that it ensures you don’t get shot at by more than a few enemies at the same time.


    Is there currently a way of knowing if the enemies are all in the same fight?
     
    Last edited: Apr 29, 2019
    redoxoder likes this.
  25. MastermindInteractive

    MastermindInteractive

    Joined:
    Jun 13, 2014
    Posts:
    86
    redoxoder likes this.
  26. EduardasFunka

    EduardasFunka

    Joined:
    Oct 23, 2012
    Posts:
    461
    Curent version in the store I belive works up to 2019.2 beta.
    Now we have different problem New version only works on 2019.2 beta because how unity saves asset file where we store UI data... need to copy paste lots of stuff manually to make it work on 2017.
     
  27. MastermindInteractive

    MastermindInteractive

    Joined:
    Jun 13, 2014
    Posts:
    86
    @EduardasFunka - I want to add a delay every time the enemy sees the player initially. Right now when they see the player, they instantly jump into action. I want them to wait between a certain random amount of time to give the player a chance to get away without fully alerting them. If the enemy still sees them once that time is up, then they jump into action. If that is too difficult, I simply want to add a delay to the enemy's actions once they spot the player. How can I do this?
     
  28. jandernunes

    jandernunes

    Joined:
    Nov 18, 2013
    Posts:
    5
    No problems!
    I'm really looking forward to this update.
    I was looking to buy another AI asset, but I'm afraid of conflicts. I'll wait for your asset and buy it.
     
  29. MastermindInteractive

    MastermindInteractive

    Joined:
    Jun 13, 2014
    Posts:
    86
    @jnbbender @satchell -
    Hello, I'm having this same issue. My character is facing the wrong direction when I press play. Also, the camera starts at the feet for some reason and moves up. This code you provided isn't working. It seems to be happening before start.
     
  30. MastermindInteractive

    MastermindInteractive

    Joined:
    Jun 13, 2014
    Posts:
    86
    Is anyone interested in helping me clean up and make improvements to this asset, maybe even comment and document it? I know that the developer is working really hard on new features but there are a lot of things that need to be fixed and made more performant. We can use a private github that only we access or if the developer is willing to share theirs we can submit pull and commit requests... If you are interested please feel free to PM me.
     
    JBR-games and Lay84 like this.
  31. nik_bluebird

    nik_bluebird

    Joined:
    Mar 1, 2019
    Posts:
    2
    Hello guys,

    This asset looks great. It has most of core features for making third person shooter game.
    I had some questions/doubts regarding asset, so I emailed it to developer 3 days ago.

    But it looks like customer support isn't good. There is no ticket system also, which tracks everyone's request. I seen many questions/queries unanswered in this forum.
     
  32. Ralrigs

    Ralrigs

    Joined:
    Nov 17, 2014
    Posts:
    10
    Damn add multiplayer with assault gamemode and im in, im behind a kit TPS with multiplayer mode and this one have good AI in bonus but its missing the multiplayer
     
  33. f1chris

    f1chris

    Joined:
    Sep 21, 2013
    Posts:
    267
    Thanks but I Patreon him for 6 months to have access to latest Github but last few times i tried I didn’t have access to it. Just stopped Patreon !
     
  34. MastermindInteractive

    MastermindInteractive

    Joined:
    Jun 13, 2014
    Posts:
    86
    I wonder if he’s be willing to sell the rights to it flat out just like the folks sold UFPS to Opsive... or if he’s be willing to partner with one of us to run support and updates on the core asset while he works on the fun stuff...
     
  35. EduardasFunka

    EduardasFunka

    Joined:
    Oct 23, 2012
    Posts:
    461
    Hi
    strange I can see your acc in our repo
    upload_2019-5-3_14-15-18.png
     
  36. EduardasFunka

    EduardasFunka

    Joined:
    Oct 23, 2012
    Posts:
    461
    we fixed bug when a character faces the wrong direction on start.
     
  37. EduardasFunka

    EduardasFunka

    Joined:
    Oct 23, 2012
    Posts:
    461
    If you want to help with the asset you are welcome, not sure about the legal side but we can chat about those things in private.
     
  38. MastermindInteractive

    MastermindInteractive

    Joined:
    Jun 13, 2014
    Posts:
    86
    I've made a lot of changes to the TPCS scripts. Would you mind sharing what those changes are so that I can fix it in my version?
     
  39. Toby31

    Toby31

    Joined:
    Jul 7, 2014
    Posts:
    38
    Currently struggling through trying to link Inventory Pro with Playmaker and the Third person cover shooter template. have read through the forum and have seen people have managed to make it work with the template. Only want a basic inventory to store weapons, medkit and ammo. Have watched multiple tuts and have set up a medkit in inv Pro with TPCST Character in test scene following along with
    on play cannot select medkit to show in inventory. Have also watched this tut and tried this method with a weapon and weapon/cube doesn't show up in inventory. but just disappears on play

    @Paul-Swanson has linked me to this video for creating a bridge to reference playmaker and the TPCST but have not yet set this up.

    I'm totally new to Playmaker and inventory pro and was wondering if anybody has used any useful tutorials/ links or can make one to integrate Inventory Pro? @AshyB @Rahd @f1chris
    Will a bridge script need to be written to reference TPCST to Inventory Pro? What will this consist of? will it be a similar deal as the one that would need to be written for playmaker to TPCST?
    @EduardasFunka With the upcoming update is an inventory something you will be including or a bridge or due to be released in a near future update?

    Any advice would be greatly appreciated, thanks in advance :)
     
  40. MastermindInteractive

    MastermindInteractive

    Joined:
    Jun 13, 2014
    Posts:
    86
    Script Update - Realistic(ish) Bullet Projectile Damage

    I noticed that when I shot at anything and it moved, the projectile would still register a hit on the target even though a lot of the time it was not at that position anymore. This resulted in the enemy being well beyond the original hit point and still registering as a hit; blood would instantiate in the open air. Further, if you tried to lead the shot and shoot in front of the moving target, it wouldn't work in the current implementation.

    Here is a change to the Projectile.cs script to 1) check if your original target is still at the area you originally shot once the projectile reached that spot and 2) checks if the bullet has collided with anything before it reaches it's destination. This does not use rigidbodies.



    Code (CSharp):
    1.  
    2.         // Added for realistic projectile damage
    3.         private Vector3 startPosition;
    4.         private Vector3 newTargetPosition;
    5.         private bool hitSomethingElse = false
    6.  
    7. private void OnEnable()
    8.         {
    9.             // Set the start position of this projectile
    10.             // so that we can use it as the starting point of the Linecast
    11.             startPosition = transform.position;
    12.             _path = 0;
    13.         }
    14.  
    15. private void FixedUpdate()
    16.         {
    17.             // Check every so often to see if we hit a player or enemy other than the
    18.             // original target
    19.             RaycastHit rc;
    20.             if(Physics.Linecast(startPosition, transform.position, out rc))
    21.             {
    22. if (rc.collider.gameObject.tag != Hit.Attacker.gameObject.tag)
    23.                 {
    24.                     // Update the Target information with the new target
    25.                     Target = rc.collider.gameObject;
    26.                     Hit.Target = Target;
    27.                     Hit.Position = rc.point;
    28.                     Hit.Normal = -rc.normal;
    29.                     newTargetPosition = Hit.Position;
    30.                     hitSomethingElse = true;
    31.                     Target.SendMessage("OnHit", Hit, SendMessageOptions.DontRequireReceiver);
    32.                     GameObject.Destroy(gameObject);
    33.                 }
    34.             }
    35.         }
    36.  
    37. private void Update()
    38.         {
    39.             transform.position += Direction * Speed * Time.deltaTime;
    40.             _path += Speed * Time.deltaTime;
    41.  
    42.             // Don't continue to run this if it is determined that
    43.             // another object intersected the trajectory path
    44.             if (!hitSomethingElse)
    45.             {
    46.                 if (_path >= Distance)
    47.                 {
    48.                     if (Target != null)
    49.                     {
    50.                         // Check the hit position to update the Hit information in case the target has moved.
    51.                         Collider[] hitColliders = Physics.OverlapSphere(Hit.Position, 0.25f);
    52.                         Vector3 dir = Hit.Position - Hit.Attacker.transform.position;
    53.  
    54.  
    55.                         for (int i = 0; i < hitColliders.Length; i++)
    56.                         {
    57.                             // Apply force at the position.
    58.                             Rigidbody r = hitColliders[i].GetComponent<Rigidbody>();
    59.                             if (r != null)
    60.                             {
    61.                                 r.AddForceAtPosition(dir.normalized * 1000, Hit.Position);
    62.                             }
    63.  
    64.                             // Determine if the tag of the collider is the same as the original
    65.                             // This requires that you add a tag to your gameobjects
    66.                             if (hitColliders[i].tag == Hit.Target.tag)
    67.                             {
    68.                                 Target.SendMessage("OnHit", Hit, SendMessageOptions.DontRequireReceiver);
    69.                                 break;
    70.                             }
    71.                         }
    72.  
    73.                     }
    74.  
    75.                     GameObject.Destroy(gameObject);
    76.                 }
    77.             }
    78.         }
    This could probably use some improvements. For instance, I could probably use another Linecast instead of an OverlapSphere at the end of the projectile's path to see if it still hit the original intended target.

    This is a little more performant than running it in the Update function but it could probably be improved.

    If you have updates, fixes or changes, don't hesitate to share.
     
    Last edited: May 5, 2019
    redoxoder, Lay84 and f1chris like this.
  41. Moe-Mogare

    Moe-Mogare

    Joined:
    Apr 16, 2015
    Posts:
    14
    Thank you & what I meant by a Tutorial is if possible just some screen shots of the steps, & I really hope you get better my friend, hopefully this might help Boil some water with cinnamon, & grind up some ginger & toss it in there & drink it with honey
     
  42. EduardasFunka

    EduardasFunka

    Joined:
    Oct 23, 2012
    Posts:
    461
    Update.
    Now AI can tell commands to other AI so you can make turns. wait before attacking etc. Coding will be done on Wednesday. Only documentation and promo material left.
     
  43. Lay84

    Lay84

    Joined:
    Mar 8, 2014
    Posts:
    32
    Hey guys, I just noticed that I do not have the red laser aiming line working (top down mobile).... i also noticed on @satchell tutorial he doesnt either, is this something that was taken out or is there a box that I need to check to turn this on.

    @EduardasFunka Excited for the news!
     
    Last edited: May 6, 2019
  44. gsmax

    gsmax

    Joined:
    Jun 12, 2018
    Posts:
    10
    Hi guys, when my AI calls a spawner, it sometimes spawns an AI that just dies immediately it appears. Please what could be causing this.
     
  45. EduardasFunka

    EduardasFunka

    Joined:
    Oct 23, 2012
    Posts:
    461
    Maybe you spawn dead AI from the scene? try span from the project folder, not from the scene.
     
    gsmax likes this.
  46. Sarhanbh

    Sarhanbh

    Joined:
    Apr 15, 2015
    Posts:
    41
    Hi, How i can move the character (civilian or enemy) using external script? I try this code but the character not move
    Code (CSharp):
    1. GetComponent<CoverShooter.AIMovement>().ToWalkTo(destination);
     
  47. Lay84

    Lay84

    Joined:
    Mar 8, 2014
    Posts:
    32
  48. EduardasFunka

    EduardasFunka

    Joined:
    Oct 23, 2012
    Posts:
    461
    you a
    you activate it now with Right mouse click
     
  49. Lay84

    Lay84

    Joined:
    Mar 8, 2014
    Posts:
    32
    for Mobile?
     
  50. gsmax

    gsmax

    Joined:
    Jun 12, 2018
    Posts:
    10
    Hi everyone, I created icons to mark my AI's on a minimap. Each AI has two icons, one for when alive and the other when dead. Can anyone please help me with a script to set activate (true or false) depending on if the AI is alive or dead.
    Am having troubles referencing the Characterhealth script .
    Thanks.
     
unityunity