Search Unity

Third person cover controller

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

  1. hitboxfun

    hitboxfun

    Joined:
    Mar 5, 2018
    Posts:
    6
    how i will add shot gun. any idea?
     
  2. hitboxfun

    hitboxfun

    Joined:
    Mar 5, 2018
    Posts:
    6
    i get this Error when pause and unPause game

    rigidbody.velocity assign attempt for 'Enemy 3 (Clone 1)' is not valid. Input velocity is { NaN, 0.000000, NaN }.
    UnityEngine.Rigidbody:set_velocity(Vector3)
    CoverShooter.CharacterMotor:applyVelocityToTheGround(Vector3) (at Assets/ThirdPersonCoverShooter/Scripts/Character/CharacterMotor.cs:2499)
    CoverShooter.CharacterMotor:OnAnimatorMove() (at Assets/ThirdPersonCoverShooter/Scripts/Character/CharacterMotor.cs:2464)
     
  3. IndieGeek

    IndieGeek

    Joined:
    Sep 30, 2016
    Posts:
    16
    That would be great!
     
  4. EduardasFunka

    EduardasFunka

    Joined:
    Oct 23, 2012
    Posts:
    467
    You need sounds and particles and replace rifle ones with your shotgun ones. Then adjust rate of fire.
     
    hitboxfun likes this.
  5. pushingpandas

    pushingpandas

    Joined:
    Jan 12, 2013
    Posts:
    1,419
    Yo zenGarden, arnt you the dude from the ultimate survival asset forum?

    Eduardas, awesome work!
     
    Rahd likes this.
  6. Rahd

    Rahd

    Joined:
    May 30, 2014
    Posts:
    324
    recoil , if anyone want's to make it up and down left right randomly :
    go to gun script , private void fire(
    and replace
    ---------------
    _recoilImpulses.Add(new RecoilImpulse(Vector3.Lerp(-Direction, Vector3.up, RecoilSettings.UpForce)));
    with : ----------------
    int recoilhash = UnityEngine.Random.Range (0, 3);
    switch (recoilhash) {
    case 0 :
    _recoilImpulses.Add(new RecoilImpulse(Vector3.Lerp(-Direction, Vector3.up, RecoilSettings.UpForce)));
    break ;
    case 1 :
    _recoilImpulses.Add(new RecoilImpulse(Vector3.Lerp(-Direction, Vector3.down, RecoilSettings.UpForce)));
    break ;
    case 2:
    _recoilImpulses.Add(new RecoilImpulse(Vector3.Lerp(-Direction, Vector3.left, RecoilSettings.UpForce)));
    break ;
    case 3 :
    _recoilImpulses.Add(new RecoilImpulse(Vector3.Lerp(-Direction, Vector3.right, RecoilSettings.UpForce)));
    break ;
    }
     
  7. owen_proto

    owen_proto

    Joined:
    Mar 18, 2018
    Posts:
    120
    Is anyone able to provide some guidance as to how to require a button press to exit cover and to constrain movement to being along the cover surface until cover is exited? i.e. "sticky" cover.
     
  8. Unplug

    Unplug

    Joined:
    Aug 23, 2014
    Posts:
    256
    @Rahd man you are so helpful on this asset, I wish you were my neighbor so we can work together lol
     
    Rahd likes this.
  9. Rahd

    Rahd

    Joined:
    May 30, 2014
    Posts:
    324
    Bug on Hit effects :
    so if you place the Hit effect script on a terrain and shoot it it will work just fine
    but if your bullets hit nothing like they go into the air or dies before hitting any coliders
    the gun script will send the last position and send a target to the projectile script and this happens :

    to fix it replace (Not sure what are the effect on the auto targeting system for mobile) :
    var projectile = bullet.GetComponent<Projectile> ();
    var vector = end - Origin;
    if (projectile != null) {
    projectile.Distance = vector.magnitude;
    projectile.Direction = vector.normalized;
    if (hit.collider != null ) {
    projectile.Target = hit.collider.gameObject;
    projectile.Hit = new Hit (hit.point, -Direction, Damage, Character.gameObject, hit.collider.gameObject);
    }

    With
    if (projectile != null) {
    projectile.Distance = vector.magnitude;
    projectile.Direction = vector.normalized;
    if (hit.collider != null) {
    projectile.Target = hit.collider.gameObject;
    projectile.Hit = new Hit (hit.point, -Direction, Damage, Character.gameObject, hit.collider.gameObject);
    } else {
    projectile.Target =null;

    }
     
    redoxoder likes this.
  10. Rahd

    Rahd

    Joined:
    May 30, 2014
    Posts:
    324
    man i wish that too , it suck doing a game solo :( , thanks :)

    in public class CharacterMotor
    add this
    -------------
    public bool coveronoff = true ;
    public void changecoverofoff(){
    coveronoff = !coveronoff;


    }

    now under
    private void LateUpdate()
    {

    add :

    if( coveronoff) {
    _potentialCover = null;
    }

    now make a button and on click add the func changecoverofoff() after you place the CharacterMotor in the onclick
    let me know if it works i did not test it .
     
    redoxoder likes this.
  11. hitboxfun

    hitboxfun

    Joined:
    Mar 5, 2018
    Posts:
    6
    thank you for your replay I am talking about multiple hits like a shot gun. please add in your next update
     
    Rahd likes this.
  12. Rahd

    Rahd

    Joined:
    May 30, 2014
    Posts:
    324
    well you can make multiple projectiles inside the bullet , and randomize the x and y around the of aim point
    here is my script but for one bullet since more than one is too much for mobile .

    float dist = Vector3.Distance(Target , origin ); / this will calculate the Distance from gun to target


    accuracy = ((Distance / 100) * dist ) /accuracycoefficient; this will give you a value based on the guns bullet range ( range can be found in gun script under the name "Distance" )

    if (accuracy < 0) {
    accuracy = 0.01f;
    } this will check if it's negative like target is too close and set it to 0
    value = Target - origin;
    var randomx = Random.insideUnitCircle * accuracy ;
    var randomy = Random.insideUnitCircle * (accuracy *1.2f);
    value = new Vector3 (value.x + randomx.x, value.y + randomy.y, value.z ); this will give you a random aim point around the target based on distance and range
    this is for mobile and can be added under gun script like this (firemode_auto_semi is the switch for this mode for example) :

    public float acurcytest=5;
    public float finalacurcy=0;
    public bool firemode_auto_semi = false ;
    /// <summary>
    /// Calculates perfect vector from given origin to Target.
    /// </summary>
    ///
    private Vector3 getTargetDirectionFrom(Vector3 origin)
    { var value = Target - origin;
    if (firemode_auto_semi) {
    value = Target - origin;
    if (value.magnitude > float.Epsilon)
    value.Normalize ();



    } else {
    float dist = Vector3.Distance(Target , origin );
    finalacurcy = ((Distance / 100) * dist ) /acurcytest;
    if (finalacurcy < 0) {
    finalacurcy = 0.01f;
    }
    value = Target - origin;
    var randomx = Random.insideUnitCircle * finalacurcy;
    var randomy = Random.insideUnitCircle * (finalacurcy*1.2f);
    value = new Vector3 (value.x + randomx.x, value.y + randomy.y, value.z );
    if (value.magnitude > float.Epsilon)
    value.Normalize();
    }
    return value;
    }
    you can still use the same concept in TPS mode too just grab Random.insideUnitCircle and add it to the projectile path on x and y only or something like in burst mode here :
     
    Last edited: Mar 20, 2018
    redoxoder and EduardasFunka like this.
  13. Azman138

    Azman138

    Joined:
    Jul 8, 2017
    Posts:
    15
    Hey EduardsFunka its really a great asset i just purchased it . People can make a whole game and a lots of game by buying only this asset pack.I really loved it. But the I have a problem with the mobile integration. I almost finished many levels of my game.But at the last stage when i am trying to add a pausemenu script it shows error.I mean when i play the game in the console editor it shows as the picture i uploaded and also when i build the game as apk and run it on my android when i press pause and then resume the game the scene becomes black like the other picture . And the pause script picture also.I am not a programmer .So please give me a better solution
     

    Attached Files:

  14. Azman138

    Azman138

    Joined:
    Jul 8, 2017
    Posts:
    15

    Same here. Why the author is not replying?
     
  15. EduardasFunka

    EduardasFunka

    Joined:
    Oct 23, 2012
    Posts:
    467
    Because I do support by email. And its weekend. Send an email
     
    Last edited: Mar 24, 2018
    pushingpandas likes this.
  16. Azman138

    Azman138

    Joined:
    Jul 8, 2017
    Posts:
    15
    Hey Rahd, How did you added the pause script.Can you please explain it or suggest me a pause screen script in game.Timescale didn't work. It gives me error.






     
  17. Rahd

    Rahd

    Joined:
    May 30, 2014
    Posts:
    324


    I did not make that ,thanks for reminding me , i had no plans to pause that game lol
    so i did test the time scale = 0 and it will make an error (rigidbody.velocity assign attempt for) on the player because i think the player and AI scripts wants a value in the time to similate gravity and animations .
    so it's easy to trick it by simply giving a value so low that the game will pause but not really

    so here is my script for the setting menu :

    public void OpenSetting()
    {

    Settingmenuopen = !Settingmenuopen;
    Settingmenu.SetActive ( Settingmenuopen);
    FPScounter.SetActive (Settingmenuopen);
    if (Settingmenuopen) {
    Time.timeScale = 0.0001f;
    } else {
    Time.timeScale = 1;
    }
    }

    Settingmenuopen is the bool that will become true if the menu is open , and false when is not
    so when the menu is open ,Time.timeScale will be 0.0001f; this will pause the game
    when the close button call OpenSetting() again it will make it false and the time scale will be back to 1
    you can change the 0.0001f; to 0.00000001f; just to make sure it will pause it
    i hope this will fix it , let me know .
     
    Last edited: Mar 24, 2018
  18. Azman138

    Azman138

    Joined:
    Jul 8, 2017
    Posts:
    15
    Yeah it, worked in my project .I mean the unity editor is ok but when i build the game and pause unpause it became black . Only the canvas became visible.

    Now i am getting this error.That's why i cant check if its alright or not..look in the picture.Do you know how to fix it?






     

    Attached Files:

    Last edited: Mar 25, 2018
  19. Rahd

    Rahd

    Joined:
    May 30, 2014
    Posts:
    324
    yeah you might wanna change drawFOV() on AISight to :
    private void drawFOV()
    {
    // var direction = _actor == null ? transform.forward : _actor.HeadDirection;
    // var head = _actor == null ? (transform.position + Vector3.up * 2) : _actor.StandingTopPosition;
    // direction = Quaternion.AngleAxis(-FieldOfView * 0.5f, Vector3.up) * direction;
    // Handles.color = new Color(0.5f, 0.3f, 0.3f, 0.1f);
    // Handles.DrawSolidArc(head, Vector3.up, direction, FieldOfView, Distance);
    // Handles.color = new Color(1, 0.3f, 0.3f, 0.75f);
    // Handles.DrawWireArc(head, Vector3.up, direction, FieldOfView, Distance);
    // Handles.DrawLine(head, head + direction * Distance);
    // Handles.DrawLine(head, head + Quaternion.AngleAxis(FieldOfView, Vector3.up) * direction * Distance);
    }

    and change using UnityEditor; to //using UnityEditor;
    yeah about the black screen , i test it on 5 phones , it seams to work just fine on Note 4 , Note Edge , Samsung S5 , Moto X , Sony X Z and Z3
    what are you testing it on ??
    could be this :
    • (1013174 (970945)) - Android: Fixed Time.deltaTime sometimes returning a negative value on certain devices/Android versions.
      Patch 2017.2.2p2 will fix it
     
    Last edited: Mar 31, 2018
  20. Pollawat

    Pollawat

    Joined:
    Aug 27, 2016
    Posts:
    192
    Hello, I'm a newbie so sorry about that.



    How to set up AI to fire at a very long range. As you can see in the video, he can only damage the player at a very close range.


    ps, firearm, and player detection already set at 150 points.
     
  21. Rahd

    Rahd

    Joined:
    May 30, 2014
    Posts:
    324
    nice game :)
    select the gun and change the distance limit
    example if it's 10 the bullet will be destroyed before it hits the target
    thats my guess
     
    EduardasFunka likes this.
  22. f1chris

    f1chris

    Joined:
    Sep 21, 2013
    Posts:
    335
    Can you please email give us a quick update on v1.5 and an overview of the changes?

    Thanks
     
  23. EduardasFunka

    EduardasFunka

    Joined:
    Oct 23, 2012
    Posts:
    467
    Big feature is "Teams".
    Now you can set up a team with abilities that follow a player in 3 different formations and heal him or buff him or resurrect. You can setup enemy team and they can heal each other and buff etc. You can set up 2 AI teams to fight. You can set who to prioritize in a fight to shoot (closes target, team leader target, low Hp etc.) or who to protect.

    Right now we polishing Third person controller it already feels a lot better when you play it. Maybe ~50 tasks were completed to get that polished feeling. Today's task is to redo how a player uses tall cover. Right now the problem is when u shoot from the left side so we decided to do a gun swap from right arm to left arm like it does in the division.
    Tomorrow's task is how a player approaches low cover we want him to detect it sooner to make a more natural transition.

    Also added about 30 new animations how a player carries guns and reworked animation tree to prepare for new weapons and mele in future updates.
    We plan to make a comparison video before pushing to the store.
     
  24. JohnnyMaze

    JohnnyMaze

    Joined:
    Mar 29, 2018
    Posts:
    1
    looks promising
     
  25. f1chris

    f1chris

    Joined:
    Sep 21, 2013
    Posts:
    335
    wow...it’s a major one then. Thanks for the update !
     
  26. pushingpandas

    pushingpandas

    Joined:
    Jan 12, 2013
    Posts:
    1,419
    Any idea when you release 1.5?
     
  27. Rahd

    Rahd

    Joined:
    May 30, 2014
    Posts:
    324
    lovely update :) one issue still struggling with :
    make the AI Forget target and go back to the original starting point.
    add Rotation for the AI waypoints :(
     
    Munken and MastermindInteractive like this.
  28. Unplug

    Unplug

    Joined:
    Aug 23, 2014
    Posts:
    256
    really nice, can't wait to see those changes !!! AI will improve from 1.4 ?
     
  29. IndieGeek

    IndieGeek

    Joined:
    Sep 30, 2016
    Posts:
    16
    Player is acting wired on zooming with sprite scope only. Without scope sprite and in crouch position zooming is working fine but with sprite scope player zooms toward the sky right above the head.
    CrouchZoomFine.PNG Zooming.PNG
    What's I'm doing wrong?
     
    Last edited: Apr 1, 2018
  30. Pollawat

    Pollawat

    Joined:
    Aug 27, 2016
    Posts:
    192
    Hello, I got a question while building.

    Assets/ThirdPersonCoverShooter/Scripts/AI/Controllers/AISight.cs(178,13): error CS0103: The name `Handles' does not exist in the current context

    Error building Player because scripts had compiler errors.
     
  31. Rahd

    Rahd

    Joined:
    May 30, 2014
    Posts:
    324
     
  32. tr1stan

    tr1stan

    Joined:
    Jan 23, 2009
    Posts:
    150
    Hello, does current 1.4 version has mele take down?
    I remember you mentioned multiplayer support before. Does it still in the plan?
     
  33. Azman138

    Azman138

    Joined:
    Jul 8, 2017
    Posts:
    15
    Thanks it worked. I am using Xiaomi Redmi Note 4 3/32gb version.




     
    Rahd likes this.
  34. Pollawat

    Pollawat

    Joined:
    Aug 27, 2016
    Posts:
    192
    Character animation stuck while running on sloped terrain.



    As you can see in the video, how to fix this?

    ps. this will not happen if the character walks on cube or plane object but it always happens on a terrain.
     
  35. Rahd

    Rahd

    Joined:
    May 30, 2014
    Posts:
    324
    player script
    numbers on fall and jump threshold , change them until it's fixed and the player can jump and fall . you need to find the best spot
    It's buggy with the terrain i end up removing the "auto jump" and made a jump button only
     
    Last edited: Apr 5, 2018
  36. Unplug

    Unplug

    Joined:
    Aug 23, 2014
    Posts:
    256
    I found that when you are firing while the playing hold the gun next to his leg (like not aiming) it actually fire from that position before he actually point the gun. What is the best way to delay the actual physical raycast and visual bullet trail until he reach the aim/shoot position ?
     
  37. Pollawat

    Pollawat

    Joined:
    Aug 27, 2016
    Posts:
    192
    Error building Player because scripts had compiler errors

    Assets/ThirdPersonCoverShooter/Scripts/AI/Controllers/AISight.cs(176,13): error CS0103: The name `Handles' does not exist in the current context



    When I double click the message it leads to this point.



    Please help, I don't know what to do.
     
  38. Rahd

    Rahd

    Joined:
    May 30, 2014
    Posts:
    324
  39. Pollawat

    Pollawat

    Joined:
    Aug 27, 2016
    Posts:
    192
  40. Rahd

    Rahd

    Joined:
    May 30, 2014
    Posts:
    324
    that's just for debuging the aim in the editor , to show you the where the Ai is looking ,
    if you want it back just go back to old script , cheers :)
     
  41. zeekindustries

    zeekindustries

    Joined:
    Jun 4, 2010
    Posts:
    19
    Hello everyone!

    I found on the thread that there was some Rewired implementation already done in the past, is there any chance this is coming officially to this package. We just got this asset and definitely would love to see any form of integration.

    Thanks, congratulations on the great work!
     
    MastermindInteractive likes this.
  42. EduardasFunka

    EduardasFunka

    Joined:
    Oct 23, 2012
    Posts:
    467
    Update on 1.5
    don't have exact numbers but performance with AI about 20 times better
    upload_2018-4-13_12-51-30.png
     
    pushingpandas, Hamesh81, Rahd and 2 others like this.
  43. Hamesh81

    Hamesh81

    Joined:
    Mar 9, 2012
    Posts:
    405
    Hi @EduardasFunka , just have a quick question about the AI. I noticed that in the tutorial video the AI character motor has a climbing settings section so does that mean that the AI can climb up similar to the player controller? Also I could not see any navmesh related components on the AI, does that mean it doesn't use the unity navmesh for pathfinding?
     
    Last edited: Apr 15, 2018
  44. EduardasFunka

    EduardasFunka

    Joined:
    Oct 23, 2012
    Posts:
    467
    We plan for Ai to climb and jump in future. We trained them to roll from explosions in 1.5
     
    Hamesh81 likes this.
  45. Hamesh81

    Hamesh81

    Joined:
    Mar 9, 2012
    Posts:
    405
    Oh ok great. One other thing I can't work out if it is included or not is having the AI return after they have finished a search/investigation. For example AI is patrolling or guarding a door, hears/sees player, chases after the player, player escapes, AI returns back to their patrol route or door being guarded.
     
    Last edited: Apr 15, 2018
  46. Unplug

    Unplug

    Joined:
    Aug 23, 2014
    Posts:
    256
    nice to see performance improvement. it was impossible to run many AI at a time.
    Still haven't found anything on the bug i reported

    I found that when you are firing while the playing hold the gun next to his leg (like not aiming) it actually fire from that position before he actually point the gun. What is the best way to delay the actual physical raycast and visual bullet trail until he reach the aim/shoot position ?
     
    Rahd likes this.
  47. pushingpandas

    pushingpandas

    Joined:
    Jan 12, 2013
    Posts:
    1,419
    when does 1.5 hit the earth?
     
    Rahd likes this.
  48. Rahd

    Rahd

    Joined:
    May 30, 2014
    Posts:
    324
    YES
    1-Forget the player and return to a starting point
    2-return to starting point after search/investigation
    3-Return to starting point if The Ai is away of starting point (like every other game :p ) this will help in baking less Navmesh
     
  49. HiddenFace

    HiddenFace

    Joined:
    Feb 13, 2016
    Posts:
    12
    Any news from multiplayer^^?
     
  50. secondsight_

    secondsight_

    Joined:
    Mar 2, 2014
    Posts:
    163
    Hey there,
    I´m on the verge of buying this asset. I´ll use it for an iso shooter for mobile.
    Two questions, though (from a non coder):

    1. How many AI can be processed on a mobile device at the same time ? How is the performance ?
    2. While developing the game on PC using top down view, how is the game controlled ? WASD + Mouselook ?
    3. Is the top down cover shooter for mobile basically included into this package ? Wasn´t clear to me :)

    Thanks !
     
    Last edited: Apr 15, 2018