Search Unity

  1. Megacity Metro Demo now available. Download now.
    Dismiss Notice
  2. Unity support for visionOS is now available. Learn more in our blog post.
    Dismiss Notice

Third person cover controller

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

  1. rrabassa

    rrabassa

    Joined:
    Jul 17, 2013
    Posts:
    170


    Is it in the Apple App Store yet? I can't seem to find it.
     
    satchell likes this.
  2. rrabassa

    rrabassa

    Joined:
    Jul 17, 2013
    Posts:
    170
    I'd like to change the direction of gravity. Specifically I'd like to have my player walk along a sphere. Any suggestions?

    Thanks,
    rich
     
  3. satchell

    satchell

    Joined:
    Jul 2, 2014
    Posts:
    107
    Waiting for review. I'm guessing if I don't get the "In Review" email from Apple by 3:30 pm it'll be tomorrow. Amazon just got approved an hour ago.

    EDIT: All 3 app store links
    Google Play: https://goo.gl/7CVU9T
    Amazon: https://goo.gl/67LcJX
    Apple App Store: https://goo.gl/3n1D7X


    :)
     
    Last edited: Nov 3, 2018
    pushingpandas likes this.
  4. Toby31

    Toby31

    Joined:
    Jul 7, 2014
    Posts:
    70
    Thanks for the response I have now purchased the controller and look forward to using it in my next project. Have you had a chance to see if playmaker is usable with the controller?
     
  5. pushingpandas

    pushingpandas

    Joined:
    Jan 12, 2013
    Posts:
    1,419
    IMpressive work! Wish you many sales
     
    satchell likes this.
  6. Paul-Swanson

    Paul-Swanson

    Joined:
    Jan 22, 2014
    Posts:
    317
    How did you and @Rahd get the off screen indicators? I'm planning on buy the app when I get home too bye looks great
     
    Rahd likes this.
  7. satchell

    satchell

    Joined:
    Jul 2, 2014
    Posts:
    107
    @Paul-Swanson Thank you!

    Have you tried the Mobile scene? I would look at that canvas...
     
    Rahd likes this.
  8. Paul-Swanson

    Paul-Swanson

    Joined:
    Jan 22, 2014
    Posts:
    317
    I haven't because I wasnt gonna build for mobile. But I'll look at it now
     
  9. Toby31

    Toby31

    Joined:
    Jul 7, 2014
    Posts:
    70
    Has anybody got the Third person cover shooter working in the latest beta build 2018.3.0b8? I imported the controller into this version and the character in the demo scene would not walk, I could jump and shoot but not walk around. was just stuck on the spot and in the prototype scene the cowboy kind of slides along the surface? have now reverted back to 2018.2.8f1 and is its working fine. just wondered if anybody else has experienced the same problem and has a fix?
     
  10. satchell

    satchell

    Joined:
    Jul 2, 2014
    Posts:
    107
    I don't know but I just seen 2019 is available! I'll try that and let you know.
     
    Camelot63RU and Toby31 like this.
  11. Paul-Swanson

    Paul-Swanson

    Joined:
    Jan 22, 2014
    Posts:
    317
    Not yet no, Im sorry. Iv got a toddler and she has really messed with my schedule -- I can only mess with Unity after like 9PM my time. I will try it this weekend. It should be fine though, since the way you communicate back and forth with playmaker and 3rd pt stuff is basically sending messages back and forth. But I'll let you know asap.
     
  12. Paul-Swanson

    Paul-Swanson

    Joined:
    Jan 22, 2014
    Posts:
    317
    Interested as well. I want the new terrain system...no NEED it. yeah stamps! Screw Gaia its slow and crap. So Im waiting anxiously...I'll try this this weekend too..and get back to you.
     
  13. pushingpandas

    pushingpandas

    Joined:
    Jan 12, 2013
    Posts:
    1,419
    Gaia is slow and crap?!?
     
  14. Paul-Swanson

    Paul-Swanson

    Joined:
    Jan 22, 2014
    Posts:
    317
    It is yes. Initially it had no competition and thus was the best thing ever. But world creator is far faster because it uses the gpu for rapid iterations, but lacks the stamps. Gaia is all CPU all the time, and its really slow; also no support yet for multi tile, so more downside than up.

    Given that we now have stamps built in and built in multitilemsupport thereis literally nothing Gaia brings to the table that makes worth bothering with or worth the cost.
     
    Last edited: Nov 2, 2018
    pushingpandas likes this.
  15. Paul-Swanson

    Paul-Swanson

    Joined:
    Jan 22, 2014
    Posts:
    317
    I checked this on 2018.3.0b8 and found I had the same issue. I check the player character and noticed that root motion was unchecked on him. Simply check that again and you'll be golden.
    upload_2018-11-2_13-9-59.png
     
  16. pushingpandas

    pushingpandas

    Joined:
    Jan 12, 2013
    Posts:
    1,419
    Can you please add a optional ragdoll death option? And weapon / ammo pickups? And most of all . load & save function :D thankyou
     
    Blackghost and Camelot63RU like this.
  17. Blackghost

    Blackghost

    Joined:
    Oct 2, 2012
    Posts:
    110
    Hey guys. Have any of you seen this video of the abandoned project 8 Days? They were working on a cool cover system. Great inspirational video.

     
  18. rrabassa

    rrabassa

    Joined:
    Jul 17, 2013
    Posts:
    170
    I'd like to change the direction of gravity. Specifically I'd like to have my player walk along a sphere.

    Any Ideas?
     
  19. satchell

    satchell

    Joined:
    Jul 2, 2014
    Posts:
    107
    @rrabassa Have you tried anything? If so what results are you getting?
    What size is the sphere?

    I would look to see if there are any terrains that you can produce a sphere with. Or finding out what gravity properties you can manipulate via script or editor. Break the sphere up into quads that have a trigger event to adjust the gravity accordingly.
     
  20. Paul-Swanson

    Paul-Swanson

    Joined:
    Jan 22, 2014
    Posts:
    317
    I finally got to it. I had no issues. You simply need to write a bridge for the thing you want to reference in playmaker.
    Something like:

    using CoverShooter;
    OnHit (blah blah)


    or if you want to deal damge:
    CoverShooter.CharacterHealth.Deal (thx Satchell <- Got a few of my ideas to work thx to you posting the flamethrower bit.)

    Then in player maker you send the message you want back over. Im very bad at playmake so I claim to be no expert.
    I did however find this guy:

    His communication skills are pretty...meh...but he shows you how it works for the most part.
     
    Toby31 and satchell like this.
  21. Paul-Swanson

    Paul-Swanson

    Joined:
    Jan 22, 2014
    Posts:
    317
    Here's what Iv managed to put together in the last 3 weeks or so over a few hours each night.

    Like most of you I'm using the customization Soldier that was shown in the the demo videos so I have the benefit of being able to rapidly add enemies since they all use the exact same skeleton and mesh. I havnt added any in this demo yet, but they are coming soon. I wanted to setup this one guy perfectly so I don't need to change anything else later more than once.

    I had to write up a customDMG reciever and destruction system but now I can blow up barrels (and they actually do DMG!) and shatter windows...
    I'll post them later.
    And My Subway System and Parking garage probuilder prefabs. Lots of custom work here.
     
  22. Toby31

    Toby31

    Joined:
    Jul 7, 2014
    Posts:
    70
    Thank you very much for testing the Unity beta release with the controller ;) can't believe I didn't test that out myself.
    Will be buying myself a copy of playmaker for the project so fingers crossed it will be a life saver as I'm an artist and I don't code
     
  23. jnbbender

    jnbbender

    Joined:
    May 25, 2017
    Posts:
    486
    I was wondering if anyone had any ideas to preventing sliding? I am using a fairly hilly terrain and I am having issues on some of the more sloped parts getting my character to stand still. When my player runs up a slope then stops mid-slope, he will start sliding down. I have played with physic materials on the Terrain and on the player. I have used the slopedPhysicMaterial and have got a little success (slowed down the sliding). Has anyone had success keeping their player still on sloped ground?

    BTW - It would also be nice to Raycast down against other layers besides "Default". It do not want my player required to walk on the "Default" layer especially since I want my Terrain on the "Terrain" layer.
     
    Last edited: Nov 5, 2018
  24. oeoe

    oeoe

    Joined:
    Sep 26, 2018
    Posts:
    8
    All, sorry if this is a stupid question — I couldn't find the answer on this forum or the asset page. Does this support multiplayer? If yes — what service is it using? UNET/Photon/something else?
     
  25. Paul-Swanson

    Paul-Swanson

    Joined:
    Jan 22, 2014
    Posts:
    317
    Here are my 2 destructables scripts:
    This one goes on the object you want to have break:
    Code (CSharp):
    1. using System.Collections;
    2. using System.Collections.Generic;
    3. using CoverShooter;
    4. using UnityEngine;
    5.  
    6.  
    7. public class PGSBreakablesDMGReceiver : MonoBehaviour {
    8.  
    9.     //Bools
    10.     public bool CanDie = true;
    11.     public bool ReplaceWhenDead = true;
    12.  
    13.     //Floats
    14.     public float MaxHealth =3f;
    15.     public float CurrentHealth = 3f;
    16.  
    17.     //Prefabs
    18.     public GameObject DeadReplacement;
    19.     public GameObject RemoveWhenDead;
    20.     private Transform SpawnHere;
    21.  
    22.     //String Values
    23.     public string DamageGiverTag = "Bullet";
    24.  
    25.     void Start()
    26.     {
    27.         RemoveWhenDead = this.gameObject;
    28.         CurrentHealth = MaxHealth;
    29.     }
    30.  
    31.     public void OnHit(Hit hit)
    32.     {
    33.             Debug.Log(DamageGiverTag + " hit");
    34.         if (CanDie == true)
    35.         {
    36.             CurrentHealth -= 1;
    37.             Debug.Log(CurrentHealth.ToString() + " / " + MaxHealth.ToString() + " HP Remaining");
    38.         }
    39.         if (CurrentHealth < 1)
    40.             {
    41.                 GetPosition();
    42.                 Instantiate(DeadReplacement, SpawnHere.transform.position, SpawnHere.transform.rotation);
    43.                 Destroy(RemoveWhenDead);
    44.             }
    45.     }
    46.  
    47.     void GetPosition()
    48.     {
    49.         SpawnHere = RemoveWhenDead.transform;
    50.         Debug.Log("I'm Here "+SpawnHere.ToString());
    51.     }
    52.  
    53. }
    If you want it to explode out this on the object you put in the Dead Replacement Slot:
    Code (CSharp):
    1. using UnityEngine;
    2. using System.Collections;
    3. using CoverShooter;
    4.  
    5.     [RequireComponent(typeof(SphereCollider))]
    6.     public class PGS_RadialExplosion : MonoBehaviour
    7.     {
    8.         private Collider[] hitColliders;
    9.  
    10.         public float blastRadius = 4.5f;
    11.         public float explosionPower;
    12.         public float UpwardForce = 10f;
    13.         public float ExplodyDMG = 150f;
    14.         public LayerMask explosionLayers;
    15.         [Tooltip("Camera shake duration when exploded.")]
    16.         public float ShakeDuration = 0.5f;
    17.         [Tooltip("Camera shake intensity when close to the camera.")]
    18.         public float ShakeIntensity = 100;
    19.  
    20.         void Start()
    21.         {
    22.             SphereCollider SP = gameObject.GetComponent<SphereCollider>();
    23.             SP.radius = blastRadius;
    24.         }
    25.  
    26.         void OnCollisionEnter(Collision col)
    27.         {
    28.             ExplosionWork(col.contacts[0].point);
    29.         }
    30.      
    31.         void ExplosionWork(Vector3 explosionPoint)
    32.         {
    33.          
    34.             hitColliders = Physics.OverlapSphere(explosionPoint, blastRadius, explosionLayers);
    35.              
    36.                 foreach (Collider hitCol in hitColliders)
    37.                 {
    38.                     if (hitCol.GetComponent<Rigidbody>()!= null)
    39.                     {
    40.                         hitCol.GetComponent<Rigidbody>().isKinematic = false;
    41.                         hitCol.GetComponent<Rigidbody>().AddExplosionForce(explosionPower,explosionPoint,blastRadius,UpwardForce,ForceMode.Impulse);
    42. //Does Damage
    43.                         hitCol.GetComponent<CharacterHealth>().Deal(ExplodyDMG);
    44. //Shakes the camera
    45.                         ThirdPersonCamera.Shake(transform.position, ShakeIntensity, ShakeDuration);
    46.                     }
    47.                 }
    48.         }
    49.          
    50.     }
    For my broken glass I just used mesh particles on a prefab. So when it goes live its starts and explodes everywhere.
     
    Toby31, satchell and Rahd like this.
  26. Rahd

    Rahd

    Joined:
    May 30, 2014
    Posts:
    324
    play with the capsule collider on the player , you will find a physics material colored green , changing the friction and other like the multiplier will make the player grip , last time i tested it with 1.4
     
  27. jnbbender

    jnbbender

    Joined:
    May 25, 2017
    Posts:
    486
    1.4 was the height of your collider, friction only goes up to 1? I played with the collider too. When I moved the collider up, his feet sunk into the ground and when I moved it further down, the collider hit the ground on the slope which kept him from moving up. Also, he walked on the water. Last I checked only one guy did that.
     
    Last edited: Nov 5, 2018
    Blackghost likes this.
  28. Rahd

    Rahd

    Joined:
    May 30, 2014
    Posts:
    324

    First is for Non static objects like moving cars ...
    second is for terrain and anything static (non-movable)
    third is for bonce like a ball so more means the player acts like a ball
    the 4th is the average or min or max of both the first and the second
    ect ... so changing those values and playing with gravity on the characterMotor might give you the wanted results
     
    satchell and Camelot63RU like this.
  29. jnbbender

    jnbbender

    Joined:
    May 25, 2017
    Posts:
    486
    Thanks for your efforts. I looked at some videos on line and it turns out he's doing all the right calculations in CharacterMotor.cs::findGroundAndSlope() but he's using a
    Code (CSharp):
    1. const float slopeThreshold = 20f
    Don't know why he's doing that. Made it a public property and now I can adjust the slope calculations to make it all work. Don't know why he didn't add this to the interface.
     
    Paul-Swanson and Rahd like this.
  30. Rahd

    Rahd

    Joined:
    May 30, 2014
    Posts:
    324
    I think using unity's is buggy alot like really buggy . it was a smart move of him . i tried other AI systems and mostly all skip the unity collider system for floor detection . since object can slip thru the terrain .
    yes the code is correct .
     
  31. oeoe

    oeoe

    Joined:
    Sep 26, 2018
    Posts:
    8
    Pretty please : ) Do we have multiplayer here?
     
  32. rrabassa

    rrabassa

    Joined:
    Jul 17, 2013
    Posts:
    170
    I've used these scripts I found and it works very well with the basic controller but when I try to incorporate Third Person Cover, the player eventually falls off the sphere rather than walking perpendicular to the surface:

    https://github.com/SebLague/Spherical-Gravity

    Here's a quick tutorial using these scripts:


    -rich
     
  33. rrabassa

    rrabassa

    Joined:
    Jul 17, 2013
    Posts:
    170

    This is awesome so far. Do you have some story in mind?
     
  34. Paul-Swanson

    Paul-Swanson

    Joined:
    Jan 22, 2014
    Posts:
    317
    Yes actually. Island gets abandoned because of massive storm. Once it passes people start to head back and there's no further contact with anyone there anymore. Our hero was heading there as a investigator but then the vehicle gets taken out and he is knocked unconconcious by something hitting him through the window. He waes up with no gear and slowly come to realize he made it to the island he was aiming for anyway. He still got a job to do, investigate, Repair Communcation Systems and make it back alive.

    There will be some free roam like in The Division
    Its a good chance to try and learn cinemachine and all the stuff, so I'll try to have some cinematic cutscenes...
     
    Last edited: Nov 6, 2018
  35. satchell

    satchell

    Joined:
    Jul 2, 2014
    Posts:
    107
    For the GravityBody.cs
    rigidbody.useGravity = false;


    When in play mode is the Rigidbody Use Gravity true or false?
     
  36. satchell

    satchell

    Joined:
    Jul 2, 2014
    Posts:
    107
    @Paul-Swanson I'm stealing this... This is great! Working on a destructible wall right now.
     
    Lay84 and Paul-Swanson like this.
  37. jnbbender

    jnbbender

    Joined:
    May 25, 2017
    Posts:
    486
    In the code to check for grounding I have found Raycasting against "Layers.Geometry" There is no such specific layer and the tooltip in VS says, "Layers for the ground and level geometry". Where does this layer come from? And if it is a mask of layers, can I add to it? Specifically, I don't ALWAYS want to test against 'Default' but also a 'Terrain' layer.

    Also - does anyone know how to equip the Flashlight?
     
    Last edited: Nov 7, 2018
  38. Roachie

    Roachie

    Joined:
    Aug 2, 2009
    Posts:
    67
    satchell likes this.
  39. satchell

    satchell

    Joined:
    Jul 2, 2014
    Posts:
    107
    Have you asked on the Spherical Gravity github forum for "Layers.Geometry" regarding Terrain. In the video you shared the presenter has a ground Layer and planet Tag. then in the script he sets the Mask to ground. I'm guessing it could be set to a different layer for each planet object.

    For the AI Flashlight I've just messed around a bit. I'm using a custom Spot light for the Player.
     
  40. jnbbender

    jnbbender

    Joined:
    May 25, 2017
    Posts:
    486
    Yeah, that video wasn't me. But I realized that my Layers must be off. I looked deeper into the code and in the LayerManager.cs and Layers.cs, he sets up those specific layers. If that's the case, I don't know why the Raycast is working against Default. Oh well.

    For the flashlight, I tried using the flashlight script and added the prefab to the players inventory. I just wasn't sure how to associate the Flashlight animations.
     
  41. satchell

    satchell

    Joined:
    Jul 2, 2014
    Posts:
    107
    I tinkered with it for like 5 min if I get back to it and all worked out for the Player Inventory I'll let you know. Essentially, I think, it works with the Night zone script(LightZone.cs).

    private void OnTriggerEnter(Collider other)
    {
    other.SendMessage("OnEnterLight", this, SendMessageOptions.DontRequireReceiver);
    }


    And on exit... I don't think there are any animations, I'm guessing that was just a general on/off?
     
  42. rrabassa

    rrabassa

    Joined:
    Jul 17, 2013
    Posts:
    170

    When in playmode, it's off.
     
  43. satchell

    satchell

    Joined:
    Jul 2, 2014
    Posts:
    107
    @rrabassa Have you seen this?

    Player just falls off close to the equator. While I was messing around thought maybe you could move the sphere. I researched it and found an old post that might help.
    https://gamedev.stackexchange.com/questions/72277/unity-move-the-world-or-the-character
    The reply mentions snapping the sphere to keep the player as close to origin allowing other objects freedom to move and keeping the player vertical to the center mass.

    EDIT: Here's a great vid.
     
    Last edited: Nov 8, 2018
    Rahd likes this.
  44. Toby31

    Toby31

    Joined:
    Jul 7, 2014
    Posts:
    70
    Have been testing out the A.I in my test environment and noticed a few issues with my test. Have watched over the A.I tut and checked on the patch notes and can't seem to find an answer. Don't want to disturb the developer yet as I hope I'm just missing something that I haven't checked.

    1. At present the A.I seems to not use tall cover and ignores it, when close to tall cover it bugs out and then seeks low cover instead. In the character motor I have checked use tall and low covers. I'm using the A.I and covers from the third person cover scene and have auto set the openings. Is there something I've missed to check or is this a bug?

    2. When I set the A.I to search in the fighter brain script like in the A.I tut the Enemy just idles, this also happens with alerted, has anybody else noticed this or is this something that is due to be changed or updated in a later release?

    3. A small thing but looks really cool in the A.I tutorial, when the A.I is in low cover and at an edge the Enemy side steps out to the side to shoot, is this something that is due for a later release or something that has been removed? would be really cool if the player also did this. has anybody had the A.I doing this in there projects?

    Thanks in advance, any help would be greatly appreciated.
     
  45. rrabassa

    rrabassa

    Joined:
    Jul 17, 2013
    Posts:
    170

    Thanks! I'm familiar with both those videos but unfortunately neither works with TPCS. The players always fall off at the equator... I think it's need some C# mastery to figure out :)
     
    satchell likes this.
  46. rrabassa

    rrabassa

    Joined:
    Jul 17, 2013
    Posts:
    170

    I've also had both these problems. For #1, I've had some success by spacing out the cover colliders more. If they are too close together, they seem to conflict. In some cases I've had the player pulled from one cover to another.

    For #2, haven't been able to get this to work at all...

    -rich
     
  47. f1chris

    f1chris

    Joined:
    Sep 21, 2013
    Posts:
    335
    I second all that and hope we receive a detailed answer and not ‘ we’re working on new AI node design ‘
     
  48. EduardasFunka

    EduardasFunka

    Joined:
    Oct 23, 2012
    Posts:
    467
    Hi,
    Just investigated and I can see that tall cover looks broken will fix it its priority now.
     
    JBR-games and f1chris like this.
  49. EduardasFunka

    EduardasFunka

    Joined:
    Oct 23, 2012
    Posts:
    467
    Thanks tested 1 and 2 can confirm those are new bugs its priority now to fix it.

    3 we removed shot from sides on a low cover for a player. Before when you in low cover and at the end of cover you can only shoot at certain angles. It was bad game design because if angles do match you press shoot but character ignores you game looks broken. So we decided to do that character steps away from cover and shoots. we could not figure out how to do that in low covers and it still looks and feels good. Also, this feature to step away from tall cover and shoot probably took 2 months trial and error. Division probably the only cover shooter to do it right and they have tons of animations.

    we plan to do a big controller upgrade after AI. I made lots of new animations maybe we will go back to this but no promises yet as its very difficult feature to make it right.
     
    Last edited: Nov 9, 2018
  50. Toby31

    Toby31

    Joined:
    Jul 7, 2014
    Posts:
    70
    Thanks for the response and testing it out, didn't want to bother you coz I know you must be rushed of your feet.

    Had a feeling you might have had issues with the side step animation, which is a shame coz it did look cool.

    Look forward to the updates and really enjoying using the controller. :)