Search Unity

Third person cover controller

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

  1. OneSketchyGuy

    OneSketchyGuy

    Joined:
    Oct 27, 2016
    Posts:
    14
    Having trouble getting the second gun to fire in with the dual wield property. It only shoots the right handed gun. Any ideas on fixes?
     
  2. p_hergott

    p_hergott

    Joined:
    May 7, 2018
    Posts:
    414
    No kidding he isnt shooting, he was s busy with..... other things
     
  3. DevelopGamer

    DevelopGamer

    Joined:
    Nov 22, 2014
    Posts:
    24
    Does anyone know why the ai sometimes glides along the floor?
     
  4. SarhanSoft

    SarhanSoft

    Joined:
    Apr 15, 2015
    Posts:
    65
    any image for that plz? sometimes it is come from non static floor or not navmesh backed
     
  5. DevelopGamer

    DevelopGamer

    Joined:
    Nov 22, 2014
    Posts:
    24
    I'd have to attach a video, and not sure that would help.

    It happens every few seconds, it seems to last for a few seconds as well.

    I'd added a NavMeshAgent to my ai characters, as I thought this was needed. It seems the issue has gone now I removed it.

    I'm a bit confused, I realise the ai switch between waypoints/zones and unity navigation, but I thought NavMeshAgent was needed to use navigation.

    It seems removing the NavMeshAgent component has fixed the sliding issue, but I don't see how they use pathfinding without it.

    If someone can clarify I'd appreciate it.

    I feel I should add, this is the best shooter ai I've seen, and I've used a lot of assets. I'd be very upset if this asset doesn't continue in development.
     
  6. ypanos

    ypanos

    Joined:
    May 5, 2014
    Posts:
    4
    Hi guys i am trying to setup my character based on the Cowboy Version 1.6.
    Basically there is no clear video how to do this from scratch migrating from one character to the other. The videos presented at the asset store are for older version. Looking at cowboy there are a lot of scripts and objects besides the weapons to the skeleton and i have to go through all of them to figure out how to setup my character as the Cowboy.
    Is there someone that can help or at least give me a link. Otherwise i must go through everything to figure out how to setup my character.
    Thanks
     
    JBR-games likes this.
  7. HonKasumi

    HonKasumi

    Joined:
    Apr 25, 2018
    Posts:
    45
    hello there, can i get some help, i have made my character with animation and ect, nothing implemented form this asset, but im really intresting to just implement just 2 features just the zooming when having the weapon and weapon switching, could i get the help pls, i dont how how to take the codes and put it in my own character
     
  8. SarhanSoft

    SarhanSoft

    Joined:
    Apr 15, 2015
    Posts:
    65
    it not use nav mesh agent
    he use navmesh to calculate path and get points by his code. nav mesh agent calculate this directly but he don't use it
     
    DevelopGamer likes this.
  9. Rahd

    Rahd

    Joined:
    May 30, 2014
    Posts:
    324
    for mobile Same as Aim and move sticks , roll stick attach script to a copy of the aim joystick (remove the aim script after you transfer the same elements like control selection ..ect) place in the center of screen :
    Code (CSharp):
    1. using UnityEngine ;
    2. namespace CoverShooter
    3. {
    4.     /// <summary>
    5.     /// Takes directional vector of  camera  and input from  the touch screen and passes it to  Controller to roll  in relation of the camera angle and the player .
    6.     /// </summary>
    7.  // MoveIntensity to be removed .
    8.  
    9.  
    10.     public class RollStick : TouchBase
    11.     {  public  CharacterMotor player ;
    12.         public    float angle;
    13.         protected override void Update()
    14.         {
    15.             base.Update();
    16.  
    17.             if (Controller == null)
    18.                 return;
    19.             angle = AngleRoll (Delta)  ;
    20.             if (Delta.sqrMagnitude > float.Epsilon) {
    21.      
    22.            
    23.                 Controller.Aiming = Delta;
    24.  
    25.                 roll (new Vector3 (-Delta.x ,0,-Delta.y) );
    26.  
    27.             } else {
    28.  
    29.             Controller.HasAiming = false;
    30.                 }
    31.         }
    32.  
    33.         private void roll(Vector3 local)
    34.         {
    35.  
    36.  
    37.  
    38.  
    39.             var direction = getMovementDirection(local);
    40.  
    41.             if (direction.sqrMagnitude > float.Epsilon)
    42.                 Controller.InputRoll(Util.HorizontalAngle(direction));
    43.         }
    44.         private Vector3 getMovementDirection(Vector3 local)
    45.         {
    46.  
    47.        
    48.  
    49.  
    50.             var forward = Controller.BodyTargetInput - Camera .main.transform.forward;
    51.             forward.y = 0;
    52.             forward.Normalize();
    53.  
    54.             float angle;
    55.  
    56.             if (player.IsInCover)
    57.             {
    58.                 angle = Util.HorizontalAngle(forward);
    59.  
    60.                 if (player.Cover.IsLeft(angle, 45))
    61.                     angle = Util.HorizontalAngle(player.Cover.Left);
    62.                 else if (player.Cover.IsRight(angle, 45))
    63.                     angle = Util.HorizontalAngle(player.Cover.Right);
    64.                 else if (player.Cover.IsBack(angle, 45))
    65.                     angle = Util.HorizontalAngle(-player.Cover.Forward);
    66.                 else
    67.                     angle = Util.HorizontalAngle(player.Cover.Forward);
    68.  
    69.                 forward = Util.HorizontalVector(angle);
    70.             }
    71.             else
    72.                 angle = Util.HorizontalAngle(forward);
    73.  
    74.             var right = Camera .main.transform.right;
    75.             right.y = 0f;
    76.             Util.Lerp(ref _leftMoveIntensity, player.IsFreeToMove(-right) ? 1.0f : 0.0f, 4);
    77.             Util.Lerp(ref _rightMoveIntensity, player.IsFreeToMove(right) ? 1.0f : 0.0f, 4);
    78.             Util.Lerp(ref _backMoveIntensity, player.IsFreeToMove(-forward) ? 1.0f : 0.0f, 4);
    79.             Util.Lerp(ref _frontMoveIntensity, player.IsFreeToMove(forward) ? 1.0f : 0.0f, 4);
    80.  
    81.             if (local.x < -float.Epsilon) local.x *= _leftMoveIntensity;
    82.             if (local.x > float.Epsilon) local.x *= _rightMoveIntensity;
    83.             if (local.z < -float.Epsilon) local.z *= _backMoveIntensity;
    84.             if (local.z > float.Epsilon) local.z *= _frontMoveIntensity;
    85.  
    86.             return Quaternion.Euler(0, angle, 0) * local;
    87.         }
    88.         private float _leftMoveIntensity = 1;
    89.         private float _rightMoveIntensity = 1;
    90.         private float _backMoveIntensity = 1;
    91.         private float _frontMoveIntensity = 1;
    92.         public static float AngleRoll(Vector2 p_vector2)
    93.         {
    94.             if (p_vector2.x < 0)
    95.             {
    96.                 return 360 - (Mathf.Atan2(p_vector2.x,  p_vector2.y) * Mathf.Rad2Deg * -1);
    97.             }
    98.             else
    99.             {
    100.                 return Mathf.Atan2(p_vector2.x,  p_vector2.y) * Mathf.Rad2Deg;
    101.             }
    102.         }
    103.     }
    104. }
    if input roll is missing add it from the thirdPcontroller

    public void InputRoll(float angle)
    {
    _wantsToRoll = true;
    _rollAngle = angle;
    }
     
    Last edited: Nov 17, 2019
    satchell likes this.
  10. Rahd

    Rahd

    Joined:
    May 30, 2014
    Posts:
    324
    Here is a better script with delay in seconds so the player can have time to chose the roll direction .
    you can adjust other things like min delta and magnitude activation (1 or more will stop it from working )

    Code (CSharp):
    1. using UnityEngine ;
    2. namespace CoverShooter
    3. {
    4.     /// <summary>
    5.     /// Takes directional movement input from the touch screen and passes it to Mobile Controller.
    6.     /// </summary>
    7.    
    8.  
    9.  
    10.     public class RollStick : TouchBase
    11.     {  public  CharacterMotor player ;
    12.         public float Dragmin =0.5f;
    13.         public float DragActivation =0.1f;
    14.         public float slidedelay = 0.1f;
    15.         float elapsed = 0f;
    16.  
    17.         protected override void Update()
    18.         {
    19.             base.Update();
    20.             elapsed += Time.deltaTime;
    21.             if (elapsed >= slidedelay) {
    22.  
    23.                
    24.  
    25.  
    26.                 elapsed = 0;
    27.    
    28.             if (Controller == null)
    29.                 return;
    30.        
    31.             if (Delta.sqrMagnitude > DragActivation) {
    32.            
    33.                
    34.                 Controller.Aiming = Delta;
    35.                 if (Mathf.Abs (Delta.x) >= Dragmin || Mathf.Abs (Delta.y) >= Dragmin) {
    36.                
    37.                     roll (new Vector3 (-Delta.x ,0,-Delta.y) );
    38.                
    39.                 }
    40.            
    41.  
    42.             } else {
    43.          
    44.  
    45.  
    46.                 }    
    47.             }
    48.         }
    49.  
    50.         private void roll(Vector3 local)
    51.         {
    52.  
    53.  
    54.  
    55.  
    56.             var direction = getMovementDirection(local);
    57.  
    58.             if (direction.sqrMagnitude > float.Epsilon)
    59.                 Controller.InputRoll(Util.HorizontalAngle(direction));
    60.         }
    61.         private Vector3 getMovementDirection(Vector3 local)
    62.         {
    63.  
    64.              
    65.  
    66.  
    67.             var forward = Controller.BodyTargetInput - Camera .main.transform.forward;
    68.             forward.y = 0;
    69.             forward.Normalize();
    70.  
    71.             float angle;
    72.  
    73.             if (player.IsInCover)
    74.             {
    75.                 angle = Util.HorizontalAngle(forward);
    76.  
    77.                 if (player.Cover.IsLeft(angle, 45))
    78.                     angle = Util.HorizontalAngle(player.Cover.Left);
    79.                 else if (player.Cover.IsRight(angle, 45))
    80.                     angle = Util.HorizontalAngle(player.Cover.Right);
    81.                 else if (player.Cover.IsBack(angle, 45))
    82.                     angle = Util.HorizontalAngle(-player.Cover.Forward);
    83.                 else
    84.                     angle = Util.HorizontalAngle(player.Cover.Forward);
    85.  
    86.                 forward = Util.HorizontalVector(angle);
    87.             }
    88.             else
    89.                 angle = Util.HorizontalAngle(forward);
    90.  
    91.             var right = Camera .main.transform.right;
    92.             right.y = 0f;
    93.             Util.Lerp(ref _leftMoveIntensity, player.IsFreeToMove(-right) ? 1.0f : 0.0f, 4);
    94.             Util.Lerp(ref _rightMoveIntensity, player.IsFreeToMove(right) ? 1.0f : 0.0f, 4);
    95.             Util.Lerp(ref _backMoveIntensity, player.IsFreeToMove(-forward) ? 1.0f : 0.0f, 4);
    96.             Util.Lerp(ref _frontMoveIntensity, player.IsFreeToMove(forward) ? 1.0f : 0.0f, 4);
    97.  
    98.             if (local.x < -float.Epsilon) local.x *= _leftMoveIntensity;
    99.             if (local.x > float.Epsilon) local.x *= _rightMoveIntensity;
    100.             if (local.z < -float.Epsilon) local.z *= _backMoveIntensity;
    101.             if (local.z > float.Epsilon) local.z *= _frontMoveIntensity;
    102.  
    103.             return Quaternion.Euler(0, angle, 0) * local;
    104.         }
    105.         private float _leftMoveIntensity = 1;
    106.         private float _rightMoveIntensity = 1;
    107.         private float _backMoveIntensity = 1;
    108.         private float _frontMoveIntensity = 1;
    109.    
    110.     }
    111. }
    112.  
     
    satchell likes this.
  11. HonKasumi

    HonKasumi

    Joined:
    Apr 25, 2018
    Posts:
    45
    hi, sorry that i take some of your time, but may i ask you if its possible just to take some features from the asset, i have my own character that runs, jumps and hits, but i want to implement the weapon system of the asset and the switching
     
  12. Rahd

    Rahd

    Joined:
    May 30, 2014
    Posts:
    324

    those tutos playlist do cover most of the steps to make your guns work and the zoom on them .
    best approach is to have a copy of the example cowboy character and try to copy the same settings
    check for errors like null reference exception , that means you did not assign something in the camera scripts or the character scripts . it's an easy but long process .
     
  13. HonKasumi

    HonKasumi

    Joined:
    Apr 25, 2018
    Posts:
    45
    Thats exactly what i did yesterday , i put my character and the cowboy next to each other, but than i realized i need to also copy the animation and make the same because my character is small and i cant just drag and drop cowboys animation into my owns, thats thr hardest part.
    If there would be a tut that covers exactly that it would been awesome
    But thanks for letting me know im in the right path
     
  14. Rahd

    Rahd

    Joined:
    May 30, 2014
    Posts:
    324
    you don't have to do that , just replace the animation controller , with the cowboy one . if your character is a humanoid . i don't see any other way to do it .
     
  15. HonKasumi

    HonKasumi

    Joined:
    Apr 25, 2018
    Posts:
    45
    Hmmm My character has character controller already, but does it work when i drag just some part of the cowboy character controller and put it in my own? Im not really familiar with animation and now they work
     
  16. Rahd

    Rahd

    Joined:
    May 30, 2014
    Posts:
    324
    will take more time the layers and parameters tab will take time to redo . coping or dragging the stats only will not work without parameters . trying to remake the whole controller will take ages to do the transitions using the parameters .
    try to switch the controller , like make a copy of the cowboy one then replace the animations you want .
    like i said when a character is a humanoid all clips will work on it , the controller is just a big tree of animations , the animations and the character matters . can you explain what is special about your character controller , maybe there is an easy way to make it work the way you want .
     
  17. Rahd

    Rahd

    Joined:
    May 30, 2014
    Posts:
    324
    a strange bug found today on the Motor :

    public bool IsMoving
    {
    get { return _isMoving; } }
    will always return false even if _isMoving is true . had to switch _isMoving to public so i can detect movements
    is this the same for everyone ?
    or is it just me ?
     
  18. TotalPixel

    TotalPixel

    Joined:
    May 26, 2012
    Posts:
    19
    Hi all, I purchased this asset last year and have been working on a rather big game since. However I wanted to upgrade unity to 2019 and this template too. However I didn't want to import over all my work so only imported certain bits. Now my anims don't play correctly, as in melee freezes. Anyone figured out how to fix this without re adding the whole template.

    Thanks
     
  19. colpolstudios

    colpolstudios

    Joined:
    Nov 2, 2011
    Posts:
    150
    Hello everyone, I recently purchased the asset and from quickly scanning within this forum. It seems this community is the one who fixes outstanding issues with elements of the package.

    My question is rather simple:

    Can I use a joystick to control the character?

    My current version of unity is 2018.2.8f1 should I upgrade?

    Has anyone used playmaker with the product?
     
  20. Rahd

    Rahd

    Joined:
    May 30, 2014
    Posts:
    324
    for playmaker you will need to make custom script (Actions)
    as for the joystick you can map them in the Input Manager using the keyboard
    try to copy only the character controller and the animation folder from a fresh copy of the asset . (Make a copy of the project before you do this, just in case )
     
    Last edited: Nov 21, 2019
  21. colpolstudios

    colpolstudios

    Joined:
    Nov 2, 2011
    Posts:
    150
     
  22. Rahd

    Rahd

    Joined:
    May 30, 2014
    Posts:
    324
    this should cover it : https://answers.unity.com/questions/318766/use-gamepad-right-analog-stick-instead-of-mouse-to.html
    when looking for guides to make the xbox controller works with unity use gamepad not joystick
    my understanding so far is you want to use controllers like for xbox with your third person cover asset , if it's mobile you are talking please let me know it's not the same as that link .

    pro builder is not the issue :( .
    @EduardasFunka
    Not sure if this bug is fixed in the beta , i'm using 1.6 still .
    so the player will get stuck if the ground check is a tricky position ( example raycast is in a hole )

    so to fix this for now i added an addition to the GroundThreshold when moving this will allow the player to scale stairs or trick terrain .

    public float GroundThresholdMoving =0.2f;
    private void updateGround()
    {
    if (_ignoreFallTimer < float.Epsilon)
    if (IsMoving) {
    findGroundAndSlope(GroundThreshold+GroundThresholdMoving);
    } else {
    findGroundAndSlope(GroundThreshold);
    }

    else
    _isGrounded = true;
    if (_isGrounded && !_wasGrounded && IsAlive && _nogroundTimer >= 0.3f)
    {
    for (int i = 0; i < _physicsListeners.Length; i++)
    _physicsListeners.OnLand();
    _nextJumpTimer = 0.2f;
    if (Landed != null)
    Landed.Invoke();
    }
    _wasGrounded = _isGrounded;
    }
     
  23. Rahd

    Rahd

    Joined:
    May 30, 2014
    Posts:
    324
    For anyone interested in foot Ik system here is a modified one from Filmstorm
    (i removed the Pro feature and the clip curve ... )
    Tuto :

    Test on cover shooter :

    //Copyright Filmstorm (C) 2018 - Movement Controller for Root Motion and built in IK solver
    using System.Collections;
    using System.Collections.Generic;
    using UnityEngine;
    public class Footik : MonoBehaviour
    {
    public Animator anim; //Animator

    private Vector3 rightFootPosition, leftFootPosition, leftFootIkPosition, rightFootIkPosition;
    private Quaternion leftFootIkRotation, rightFootIkRotation;
    private float lastPelvisPositionY, lastRightFootPositionY, lastLeftFootPositionY;
    [Header("Feet Grounder")]
    public bool enableFeetIk = true;
    [Range(0, 2)] [SerializeField] private float heightFromGroundRaycast = 1.14f;
    [Range(0, 2)] [SerializeField] private float raycastDownDistance = 1.5f;
    [SerializeField] private LayerMask environmentLayer;
    [SerializeField] private float pelvisOffset = 0f;
    [Range(0, 1)] [SerializeField] private float pelvisUpAndDownSpeed = 0.28f;
    [Range(0, 1)] [SerializeField] private float feetToIkPositionSpeed = 0.5f;
    [Range(0, 1)] public float feetToIkPositionDistance = 0.5f;

    public bool useProIkFeature = false;
    public bool showSolverDebug = true;
    [Header("Animation Smoothing")]
    [Range(0, 1f)]
    public float HorizontalAnimSmoothTime = 0.2f; //InputX dampening
    [Range(0, 1f)]
    public float VerticalAnimTime = 0.2f; //InputZ dampening
    [Range(0, 1f)]
    public float StartAnimTime = 0.3f; //dampens the time of starting the player after input is pressed
    [Range(0, 1f)]
    public float StopAnimTime = 0.15f; //dampens the time of stopping the player after release of input
    private float verticalVel; //Vertical velocity -- currently work in progress
    private Vector3 moveVector; //movement vector -- currently work in progress

    #region Initialization
    // Initialization of variables
    void Start()
    {
    anim = this.GetComponent<Animator>();

    if (anim == null)
    Debug.LogError("We require " + transform.name + " game object to have an animator. This will allow for Foot IK to function");
    }
    // Update is called once per frame

    #endregion
    #region FeetGrounding
    /// <summary>
    /// We are updating the AdjustFeetTarget method and also find the position of each foot inside our Solver Position.
    /// </summary>
    private void FixedUpdate()
    {
    if(enableFeetIk == false) { return; }
    if(anim == null) { return; }
    AdjustFeetTarget(ref rightFootPosition, HumanBodyBones.RightFoot);
    AdjustFeetTarget(ref leftFootPosition, HumanBodyBones.LeftFoot);
    //find and raycast to the ground to find positions
    FeetPositionSolver(rightFootPosition, ref rightFootIkPosition, ref rightFootIkRotation); // handle the solver for right foot
    FeetPositionSolver(leftFootPosition, ref leftFootIkPosition, ref leftFootIkRotation); //handle the solver for the left foot
    }
    private void OnAnimatorIK(int layerIndex)
    {
    if(enableFeetIk == false) { return; }
    if(anim == null) { return; }
    // MovePelvisHeight();
    //right foot ik position and rotation -- utilise the pro features in here
    anim.SetIKPositionWeight(AvatarIKGoal.RightFoot, 1);

    MoveFeetToIkPoint(AvatarIKGoal.RightFoot, rightFootIkPosition, rightFootIkRotation, ref lastRightFootPositionY);
    //left foot ik position and rotation -- utilise the pro features in here
    anim.SetIKPositionWeight(AvatarIKGoal.LeftFoot, 1);

    MoveFeetToIkPoint(AvatarIKGoal.LeftFoot, leftFootIkPosition, leftFootIkRotation, ref lastLeftFootPositionY);
    }
    #endregion
    #region FeetGroundingMethods
    /// <summary>
    /// Moves the feet to ik point.
    /// </summary>
    /// <param name="foot">Foot.</param>
    /// <param name="positionIkHolder">Position ik holder.</param>
    /// <param name="rotationIkHolder">Rotation ik holder.</param>
    /// <param name="lastFootPositionY">Last foot position y.</param>
    void MoveFeetToIkPoint (AvatarIKGoal foot, Vector3 positionIkHolder, Quaternion rotationIkHolder, ref float lastFootPositionY)
    {
    Vector3 targetIkPosition = anim.GetIKPosition(foot);
    if(positionIkHolder != Vector3.zero)
    {
    targetIkPosition = transform.InverseTransformPoint(targetIkPosition);
    positionIkHolder = transform.InverseTransformPoint(positionIkHolder) *feetToIkPositionDistance;
    float yVariable = Mathf.Lerp(lastFootPositionY, positionIkHolder.y, feetToIkPositionSpeed);
    targetIkPosition.y += yVariable;
    lastFootPositionY = yVariable;
    targetIkPosition = transform.TransformPoint(targetIkPosition);
    anim.SetIKRotation(foot, rotationIkHolder);
    }
    anim.SetIKPosition(foot, targetIkPosition);
    }
    /// <summary>
    /// Moves the height of the pelvis.
    /// </summary>
    private void MovePelvisHeight()
    {
    if(rightFootIkPosition == Vector3.zero || leftFootIkPosition == Vector3.zero || lastPelvisPositionY == 0)
    {
    lastPelvisPositionY = anim.bodyPosition.y;
    return;
    }
    float lOffsetPosition = leftFootIkPosition.y - transform.position.y;
    float rOffsetPosition = rightFootIkPosition.y - transform.position.y;
    float totalOffset = (lOffsetPosition < rOffsetPosition) ? lOffsetPosition : rOffsetPosition;
    Vector3 newPelvisPosition = anim.bodyPosition + Vector3.up * totalOffset;
    newPelvisPosition.y = Mathf.Lerp(lastPelvisPositionY, newPelvisPosition.y, pelvisUpAndDownSpeed);
    anim.bodyPosition = newPelvisPosition;
    lastPelvisPositionY = anim.bodyPosition.y;
    }
    /// <summary>
    /// We are locating the Feet position via a Raycast and then Solving
    /// </summary>
    /// <param name="fromSkyPosition">From sky position.</param>
    /// <param name="feetIkPositions">Feet ik positions.</param>
    /// <param name="feetIkRotations">Feet ik rotations.</param>
    private void FeetPositionSolver(Vector3 fromSkyPosition, ref Vector3 feetIkPositions, ref Quaternion feetIkRotations)
    {
    //raycast handling section
    RaycastHit feetOutHit;
    if (showSolverDebug)
    Debug.DrawLine(fromSkyPosition, fromSkyPosition + Vector3.down * (raycastDownDistance + heightFromGroundRaycast), Color.red);
    Debug.DrawLine(fromSkyPosition, fromSkyPosition + Vector3.down * (raycastDownDistance ) + new Vector3 (0.1f ,0.1f ,0.1f ), Color.green);
    if (Physics.Raycast(fromSkyPosition, Vector3.down, out feetOutHit, raycastDownDistance + heightFromGroundRaycast, environmentLayer))
    {
    //finding our feet ik positions from the sky position
    feetIkPositions = fromSkyPosition;
    feetIkPositions.y = feetOutHit.point.y + pelvisOffset;
    feetIkRotations = Quaternion.FromToRotation(Vector3.up, feetOutHit.normal) * transform.rotation;
    return;
    }
    feetIkPositions = Vector3.zero; //it didn't work :(
    }
    /// <summary>
    /// Adjusts the feet target.
    /// </summary>
    /// <param name="feetPositions">Feet positions.</param>
    /// <param name="foot">Foot.</param>
    private void AdjustFeetTarget (ref Vector3 feetPositions, HumanBodyBones foot)
    {
    feetPositions = anim.GetBoneTransform(foot).position;
    feetPositions.y = transform.position.y + heightFromGroundRaycast;
    }
    #endregion

    }
     
  24. Rahd

    Rahd

    Joined:
    May 30, 2014
    Posts:
    324
    A better But slower solution to the Groundcheck stuck is to use SphereCastNonAlloc with a radius bigger than the player's collider .
    switchRaysphere is a bool that will switch the raycast from RaycastNonAlloc to SphereCastNonAlloc

    replace in findGroundAndSlope
    if (switchRaysphere) {

    count = Physics.SphereCastNonAlloc(start, SphereGroundCheckradius -0.01f, Vector3.down, Util.Hits, threshold + GroundAndSlopeoffset, Layers.Geometry);
    } else {
    count = Physics.RaycastNonAlloc(start, Vector3.down, Util.Hits, threshold + GroundAndSlopeoffset, Layers.Geometry);

    }
     
    Lay84 likes this.
  25. colpolstudios

    colpolstudios

    Joined:
    Nov 2, 2011
    Posts:
    150
    Thank you, however, I am using a Logitech dual action controller the axis is 4 and 3.

    Please note: I am not a coder and will need a little bit more help.

    What script controls the mouse camera movement do I simply copy and paste the code shown in the link?
     
  26. Lay84

    Lay84

    Joined:
    Mar 8, 2014
    Posts:
    34
    on a roll @Rahd, giving Gems to the community and keeping this alive.
     
    Rahd likes this.
  27. colpolstudios

    colpolstudios

    Joined:
    Nov 2, 2011
    Posts:
    150
  28. Rahd

    Rahd

    Joined:
    May 30, 2014
    Posts:
    324
    no coding is required
    go to input manager


    mouse x and Y upload_2019-11-25_15-55-20.png
    change it to



    more on this here : https://answers.unity.com/questions/1429429/how-to-use-right-analog-stick-from-xbox-controller.html
    the script you linked add support to both mouse and Gamepad

    i really don't have a Gamepad or use the third cover shooter (mobile) , i can't test. but that should work .
     
    colpolstudios likes this.
  29. colpolstudios

    colpolstudios

    Joined:
    Nov 2, 2011
    Posts:
    150
    I did not have to put the name of my controller into the descriptive name, but it works.

    The speed is very slow using this method on its own, how do I increase the speed?
     
  30. Rahd

    Rahd

    Joined:
    May 30, 2014
    Posts:
    324
    the Sensitivity option should take care of that 5 rows before the last tab , as you can see it's 0.1 but on the image in black it's 1
     
  31. colpolstudios

    colpolstudios

    Joined:
    Nov 2, 2011
    Posts:
    150
    I found that 3 was a good value any higher and the environment can be seen to move.

    Though, it's a little odd that when not aiming the controls for up and down are reversed. With help form my own project I was able to remap the controller keys to my joystick.

    I would also like to add the roll forward but map them to the D-pad Axis. Possibly someone has already done this and would share?

    Thank you Rahad for your help and reply
     
    Rahd likes this.
  32. colpolstudios

    colpolstudios

    Joined:
    Nov 2, 2011
    Posts:
    150
    I finally got to playtest the third person scene, I killed all the bad guys it's very hard to do. But when finished I checked the console and have 331 errors "argument is out of range" should I worry about this?
     
  33. Paul-Swanson

    Paul-Swanson

    Joined:
    Jan 22, 2014
    Posts:
    319
    NahI It's just raycast calls made before the ai completely die. It hasnt hurt mine in any meaningful way. So e of that's just debug stuff.
     
    colpolstudios likes this.
  34. colpolstudios

    colpolstudios

    Joined:
    Nov 2, 2011
    Posts:
    150
    Great thanks for the help
     
  35. Rahd

    Rahd

    Joined:
    May 30, 2014
    Posts:
    324
    in the beta "RollForward RollBackward RollLeft RollRight " are mapped try to email the dev for a copy of that .
     
  36. colpolstudios

    colpolstudios

    Joined:
    Nov 2, 2011
    Posts:
    150
    Hi Rahd, Ill ask for sure.

    For me and my controller, its axis 5 = d-pad left and right and axis 6 = d-pad up and down.

    maybe that info helps?

    To be honest, I'm working on my own project and have not really given the asset the time it needs.

    But form the initial playtest. I will be spending time with this valuable asset.

    Thankyou kind sir for your time and help so far :)
     
    Rahd likes this.
  37. p_hergott

    p_hergott

    Joined:
    May 7, 2018
    Posts:
    414
    Walking on uneven terrain, example, from street to side walk seems to stump the controller.... any tips to improve the movement so its more reliable. Also if the controller climbs a cover that isnt very wide, tends to get stuck
     
  38. Rahd

    Rahd

    Joined:
    May 30, 2014
    Posts:
    324
    for the terrain playing with the ground check value and max slope , the ground check has a bit of a problem i end up with swapping to a spherecast , since sometimes you can get stuck . check other controllers that do this better i think and change the code .
    for the cover you gonna have to tweak the cover options on the motor , but there's no golden value ... if you change the values to fit a wider cover you will lose the ability to support thin covers ...
    and jumping while in cover will make you get stuck , not being grounded while in cover will make you stuck , same for rolling while in cover or rolling to cover , you will have to add a check of those states in the checkcover ()
    like if (!grounded || isrolling || isjumping) then he will not take cover . same goes for while in cover he will exit cover if he gets not grounded or tries to roll .
     
  39. p_hergott

    p_hergott

    Joined:
    May 7, 2018
    Posts:
    414
    Its almost like the controller has no step. Like stairs mess em up.
     
  40. Rahd

    Rahd

    Joined:
    May 30, 2014
    Posts:
    324
    mickeyband likes this.
  41. studentvz

    studentvz

    Joined:
    Dec 14, 2014
    Posts:
    149
    I have started my project in Unity 2017.4.30, but I switched to Unity 2019.2.15 to test some things. Now, character and AI can't move (change position), they animate, can shoot, etc. but can't walk or run, they are stuck to initial position. How to solve this?
     
  42. Rahd

    Rahd

    Joined:
    May 30, 2014
    Posts:
    324
    rebake navmesh ?
     
  43. studentvz

    studentvz

    Joined:
    Dec 14, 2014
    Posts:
    149
    The main character/controller can't move also, it is not because of navmesh.
     
  44. p_hergott

    p_hergott

    Joined:
    May 7, 2018
    Posts:
    414
    been trying to replace the movement system with a character controller simple move, its almost working. but the current system with using a capsule collider, it cant handle ground stuff at all. stick a small rock on the ground, the controller just gets stuck on it. or any debris. ive tried setting the slope limits and everything, way through the roof, doesn't help. any advice?
     
  45. lastwinner123456

    lastwinner123456

    Joined:
    Jan 20, 2019
    Posts:
    8
    Hi guys, did anyone make another aim on top down shooter?the aim in this asset is somehow buggy.
     
  46. Rahd

    Rahd

    Joined:
    May 30, 2014
    Posts:
    324
    yeah it has alot of problems . but a lot of never seen features , like auto aim .
    let me know what problems did you had , i might have fixed them
     
  47. lastwinner123456

    lastwinner123456

    Joined:
    Jan 20, 2019
    Posts:
    8
    The aim slows down for half second and poorly aimed at opponents.It must wark faster.If you make a new scene and add a marker in it, it does not work. Maybe there you need to set the settings?
     
    Last edited: Dec 25, 2019
  48. Rahd

    Rahd

    Joined:
    May 30, 2014
    Posts:
    324
    you need to change the cancel distance on the touch aiming script , lower means a less distance to fire .
    i hope this helps , for the aim you can play with the gun values and the aim error on the motor or mobile controller i think . i changed the aiming script to something else . you can change the fire precision to have a larger auto aim angle
     
  49. lastwinner123456

    lastwinner123456

    Joined:
    Jan 20, 2019
    Posts:
    8

    in this video i put marker in fiid in inspector but marker not worked

    in this video marker don't keep up with the cursor
     
  50. Rahd

    Rahd

    Joined:
    May 30, 2014
    Posts:
    324
    ahh you're using the Top down one not mobile
    try the double tab delay on the marker script
    not sure about the first video , i will download a fresh project with the topdown and test it more.
    i think the asset is double click to keep up with marker , you gonna have to change the scripts i think .