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

Customizable Turret System

Discussion in 'Assets and Asset Store' started by ChrisSch, Sep 15, 2015.

  1. ChrisSch

    ChrisSch

    Joined:
    Feb 15, 2013
    Posts:
    763
    Totally... :D
     
  2. TonanBora

    TonanBora

    Joined:
    Feb 4, 2013
    Posts:
    493
    Hey Chris!
    I was messing with the turrets, and noticed that when parented to an object, they don't like to rotate along with their parent object.
    Is this something that might get fixed latter on?
    Or am I just missing something? :p
     
  3. ChrisSch

    ChrisSch

    Joined:
    Feb 15, 2013
    Posts:
    763
    Is that in their automated state, or player controlled? You can try changing "rotation" to "localRotation" in "LookAtEnemy()" but I haven't had much luck with rotations obeying me in local space the way I wanted them. Quaternions are my kryptonite.
     
  4. Warsoul

    Warsoul

    Joined:
    Sep 9, 2016
    Posts:
    39
    I have 2 issues for now;

    1- Why my tank turret wont stay flat and clip into my tank even if i turn off <Allow Tilting Foward> ? (Partially solved)Doesn't work with fire on sight + auto-aim


    1- I changed the <LookAtEnemy()> for localRotation but my turret became uncontrollable after i moved a while.


    2- Why my bullet wont apply physics force to my target rigidbody even if i check <Is Rigidbody> on the Bulet prefab ?
     
    Last edited: Sep 20, 2016
  5. ChrisSch

    ChrisSch

    Joined:
    Feb 15, 2013
    Posts:
    763
    Thanks for the detailed videos, especially the inspector settings!

    1) How is the turret suppose to act in your game? Is it suppose to not move at all while you're not aiming? How is it partially solved? The turret balances out based on world coordinates, not parent (that's what I meant in my previous post not being able to do) so its clipping your tank going through extremely rough terrain. I'll look into it again. PS the concept of your game looks interesting, I like how the terrain is rough instead of flat.

    2) Its probably related to the same issue from first question. Turrets not being able to rotate based on parent. I have a top-down tank game asset using the turret system so I'll try to reproduce it and look into it.

    3) Do both bullet and rigidbody have colliders? What type of colliders? Also make sure they're not triggers. I think the bullets in Turret System are triggers. But they should work as colliders too if you uncheck that.

    EDIT: What Unity version are you using?
     
    Last edited: Sep 20, 2016
  6. Warsoul

    Warsoul

    Joined:
    Sep 9, 2016
    Posts:
    39
    1) How is the turret suppose to act in your game?

    The final design is not etablished yet but i want to be able to do :

    A- Tank Turret wich is parented to the hull (localRotation) with (Topdown view with 360 aim + AI auto firing) who can switch to an (FPS view + control for manual aiming)(especialy for sniping purpose)

    B- Tank Turret wich is parented to the hull (localRotation) with (FPS view + control for manual aiming) controlled by another player on the network. (Coop Mode)

    C- Aerial Turret wich is parented to the hull (localRotation) with AI AutoAim Control.

    D- Normal Defense Turret who hide underground when reloading or passive.

    1) How is it partially solved?

    I changed the <LookAtEnemy()> for an localRotation version. It work great on Top Down or FPS control but this is not working with AI AutoAim. The AI seem to not care about the .localRotation or <LookAtEnemy()>

    3) Do both bullet and rigidbody have colliders? Also make sure they're not triggers.
    Yes, i think i forgot to uncheck the is trigger on the bullet prefab.


    There is a way to chain fire multiple barrel instead of randoming them ? It look akward for an triple cannon to shot twice the same barrel by randoming. Weapon are sequential anyway, never randomed. ;)

    Tri-Cannon Patern 1(Burts): Shot Canon 1, Shot Canon 2, Shot Canon 3, Reload All
    Tri-Cannon Patern 2(Chained): Shot Canon 1, Reload Canon 1,Shot Canon 2, Reload Canon 2,Shot Canon 3, Reload Canon 3
    Tri-Cannon Patern 3(Salvo): Shot Canon 1&2&3, Reload All

    Has my game is a multiplayer game derived from the ''Tank Multiplayer'' asset from Unity Asset Store; i need to find out how to modify yours scripts to an Network version. Has i am mainly an Designer and Modeler(Zbrush Artist); coding isn't my strengh. If you can add the Multiplayer compatibility, i'm ready to pay an extra 10$ or i can exchange some cool turrets models i can made in Zbrush for yours assets.In short; Hours of coding for hours of modeling.

    I was using Unity 5.4 0f3 but i'm installing 1f1 now.
     
    Last edited: Oct 3, 2016
  7. DudeInaScarf

    DudeInaScarf

    Joined:
    Jan 5, 2015
    Posts:
    9
    Hi, so i faced a problem, when i check in Turret System_Turret script "Secondary Enemy Too" when secondary tag triggers turrets TargetSensor collider, unity throws an NullReferenceException. NullReferenceException.png InspectorSettings.png LineOfCode.png
     
  8. Warsoul

    Warsoul

    Joined:
    Sep 9, 2016
    Posts:
    39
  9. WalterEspinar

    WalterEspinar

    Joined:
    Aug 23, 2011
    Posts:
    83
    Secondary target dont work, can you check it?
    Thanks
     
  10. TonanBora

    TonanBora

    Joined:
    Feb 4, 2013
    Posts:
    493
    Last edited: Mar 8, 2017
  11. Gunsrequiem

    Gunsrequiem

    Joined:
    May 17, 2017
    Posts:
    71
    I recently purchased your asset, and I noticed something interesting. When I place player-controlled turrets near the origin of the scene (0,0, what-have-you) they rotate just fine. However, the further I go from the origin of the scene, the more they tend to only be able to focus on the origin. I'm unable to rotate them at all further out, either horizontally or vertically. It's very strange behavior. Any thoughts on why this might be happening? Other than this small hiccup, I think it's an amazing asset!
     
  12. zisiang

    zisiang

    Joined:
    May 16, 2017
    Posts:
    6
    Hi, I am working on a Helicopter project in Unity 2018. I wish to consider Turret System for this project simulation.

    We have some questions:
    1. Can it work in Unity 2018?
    2. Can we easily configure "explosion effect" when an AI-based enemy is destroyed?
    3. Does it come with any AI-based enemy script that we could use?

    Best,
    Zi Siang

    Thank
     
  13. flymolo05

    flymolo05

    Joined:
    Mar 19, 2018
    Posts:
    2
    I have the same question as Gunsrequiem. The rotation of the turrets in First person mode seem to only rotate around a very small spot and I can't get them to work correctly.
     
  14. melonhead

    melonhead

    Joined:
    Jun 3, 2014
    Posts:
    630
    There is also a problem in unity 2018 6 1 where the rotation speed, if set below about 50 when you rotate the turret too fast it seems to jam and rotate back the other way causing the head of the turret to rotate out of line with the pivot any fixes would be welcome, it seems ok of you add * Time.deltaTime after the rotation in the script but then the rotation is very stiff and jerky