Search Unity

AutoAim: Automatic Turret Aiming system with aim-ahead for moving targets

Discussion in 'Assets and Asset Store' started by PlanetTimmy, May 8, 2012.

  1. PlanetTimmy

    PlanetTimmy

    Joined:
    Mar 13, 2010
    Posts:
    117
    Hello folks, I'd like to introduce AutoAim, an aiming scripting module that features aim-ahead for moving targets.

    Easy to use:
    AutoAim has been designed to be very straightforward to use; the components have been designed to be very easy for a non-programmer to use - it even includes a 'Turret Wizard' to assist with the set-up! Each component has its own custom editor in the Inspector with built-in context-sensitive easily-available help text for every value so that assistance is always available without even leaving the editor. Values such as arc-of-fire and minimum and maximum ranges can be interactively set in the scene view using the custom on-screen handles.



    Aim ahead of moving targets
    AutoAim can automatically work out how far ahead to aim to hit a moving target, so that your AI units won't end up firing behind their targets. If you find them to be too ruthlessly efficient, you can even turn up the 'Artificial Stupidity' value so they're more likely to miss by just a little bit.



    Multiple types of target and projectile movement supported
    The system supports three types of projectile movement:
    • Direct : Instant-hit weapons, like lasers, or single-frame instant-hit bullets.
    • Linear : Bullets that travel at a finite speed in a straight line.
    • Parabolic : Bullets that are affected by gravity.

    To intercept the target, AutoAim has to predict how it will move in the future. There are three types of target prediction supported by AutoAim:
    • Linear : Target is expected to travel in its current direction, at its current speed. This should work quite well in most situations.
    • Parabolic : Target is expected to travel under its own momentum and gravity. You might want to do this if you want to intercept an object with a ballistic trajectory.
    • Circular : Target is expected to travel in either a straight line or in a circular motion - good for shooting planes in a dogfighting game, for example.

    Limit Arc-of-fire and range
    You can optionally limit the arc-of-fire of your turret, either via the custom editor in the Inspector or via the scene view via the custom editing handles.



    Automatic targeting component
    AutoAim comes with an optional automatic targeting component so you can easily make your turret automatically select the closest valid target to aim at.

    Shooting Component
    There is an optional firing component that will handle the projectile firing for you, if you wish. It supports playing an animation when shooting.

    Split horizontal and vertical rotation
    You can apply the horizontal and vertical rotation to separate sections of your turret model.

    Full Online Documentation
    Full documentation is available at http://www.thegamemechanics.co.uk/autoaim/, and there is a support forum at http://www.thegamemechanics.co.uk/forum/.



    AutoAim is available in the Asset Store.
     
  2. PlanetTimmy

    PlanetTimmy

    Joined:
    Mar 13, 2010
    Posts:
    117
  3. PlanetTimmy

    PlanetTimmy

    Joined:
    Mar 13, 2010
    Posts:
    117
    I have just updated AutoAim to version 1.01.

    This fixes a bug that was making the swivel section of two-section turrets stay horizontal, rather than following the orientation of their parent objects.

    Coming soon: support for multiple barrels, so you can do things like two-barrel cannons, Millennium Falcon style!
     
  4. PlanetTimmy

    PlanetTimmy

    Joined:
    Mar 13, 2010
    Posts:
    117
    Version 1.02 of AutoAim is now live on the Asset Store.

    This version supports shooting from multiple barrels with a separate animation on each one, so that you can make things like the double-barrelled cannons of the type quite often featured in Star Wars.
     
  5. MaDDoX

    MaDDoX

    Joined:
    Nov 10, 2009
    Posts:
    764
    Looks really useful, and easier to setup than other similar solutions. Gratz :)
     
  6. PlanetTimmy

    PlanetTimmy

    Joined:
    Mar 13, 2010
    Posts:
    117
    Hi MaDDoX,
    I'm glad you find it useful - give me a shout if you have any issues.

    (Sorry it's taken a little while to reply - I guess the forum reply notifications must have got broken in the transition to UDN)

    Cheers,

    Tim
     
  7. reaper7

    reaper7

    Joined:
    Aug 24, 2012
    Posts:
    25
    Hi Tim,

    Got your script, brilliant is all I can say - it's 99% everything I require in a turret plugin.
    Only thing its missing is a method to stop turrets firing if there fire path is blocked by objects not defined as enemy.
    For example I have 5 turrets on a ship which are configured with limits, but within the limits there are parts of the ship eg masts, towers etc that can be within the limits of the turret rotating. This allows the turrets to fire thru the ship at the targets.
    Would it be possible to add in this feature, or is there a method to do this already?.
     
  8. PlanetTimmy

    PlanetTimmy

    Joined:
    Mar 13, 2010
    Posts:
    117
    Hi Reaper7,
    Thanks for the kind words - I'm glad you like it!

    As for the obstacle detection - it'd be pretty straightforward in the case of direct and linear projectiles - parabolic (those affected by gravity) would be less straightforward as there's no parabola intersections tests in the physics engine.

    Anyway, I'll put in support for obstacle detection for direct and linear projectiles - we'll see how it goes with parabolic!

    Cheers,

    Tim
     
  9. PlanetTimmy

    PlanetTimmy

    Joined:
    Mar 13, 2010
    Posts:
    117
    Okay, I've made an update that adds a 'Check for obstacles' option on the PrefabShooter. I've submitted it to the store; I'll post an update here once it's been approved and has gone through.
     
  10. reaper7

    reaper7

    Joined:
    Aug 24, 2012
    Posts:
    25
    Excellent Tim, did you get it to work with parabolic? All my turrets are using that method :)
     
  11. PlanetTimmy

    PlanetTimmy

    Joined:
    Mar 13, 2010
    Posts:
    117
    Ah. No, I haven't put in any specific code for them yet. If the trajectory of the projectiles is only slightly curved, or if the obstacles you're worrying about are all close by though, it should still work fairly well. I'll have a think about the best way to do parabolic.

    The new version still doesn't seem to be up on the Asset Store, though.
     
  12. reaper7

    reaper7

    Joined:
    Aug 24, 2012
    Posts:
    25
    Hi Tim, yes the trajectory is only slightly curved - using a force of min 500 so trajectory is almost 5km.
    So almost linear in nature, once its available on Assets Store, I'll give it a shot (No Pun intended :)) and report back. Thanks.
     
    Last edited: Sep 8, 2012
  13. PlanetTimmy

    PlanetTimmy

    Joined:
    Mar 13, 2010
    Posts:
    117
    It's still not up on the asset store - I guess it's because it's the weekend. Give me a shout if you need the code sent to you quickly.

    Cheers,

    Tim
     
  14. reaper7

    reaper7

    Joined:
    Aug 24, 2012
    Posts:
    25
    Thanks Tim, no real rush - still extremely happy with it as is. Can wait for it on asset store.
    Noticed you have a forum for the app that is currently offline, will you have a feature request thread when it comes online? Have a request for a user imputed time delay on the return to center selection. So turret doesn't return to center immediately after losing target. :)

    EDIT: Oh its up now, updating and trying it out right now. Thanks.

    EDIT2: Yes, thank you Tim, first attempt - it didn't appear to work, until i realised there was no Collider item attached to the obstacles. Once I attached it, bang it worked 100% turrets stopped firing thru obstacles in the path between turret and target. Thanks again. :)
     
    Last edited: Sep 10, 2012
  15. PlanetTimmy

    PlanetTimmy

    Joined:
    Mar 13, 2010
    Posts:
    117
    Ah. The new version is up on the store now:

    Version 1.03:
    -------------
    * Adds a 'Check for obstacles' option to the prefab shooter. When checked, this will not shoot
    when an obstacle falls between the gun and the target.
     
  16. PlanetTimmy

    PlanetTimmy

    Joined:
    Mar 13, 2010
    Posts:
    117
    I've updated the version on the Asset store to 1.04.

    The new release just allows you to move the 'AutoAim' install directory to a non-root location in your project. Previously doing so would break the Turret Wizard.
     
  17. NavpointSoftware

    NavpointSoftware

    Joined:
    Apr 30, 2011
    Posts:
    102
    Hi Tim,

    Purchased this asset today and im really impressed, exactly what I need.

    I do have a couple of questions however:-

    1. Im a non programmer and am using Uscript to generate my code. Slight modifications are pretty easy since most of the variables are public.
    The thing im stuck with though is im trying to add a muzzle flash on each barrel when a bullet is fired, what is the best way of doing this?

    Work around is to add a particle effects to the bullet prefab, im not sure is the best way though.

    2. Id also like tracers, so every 5 bullet is a tracer round. I can create this in Uscript no problems by replacing the prefab. but the thing im stuck with is knowing when the gun is actually fired.

    Awesome little plug-in though and so far its doing pretty much what I require!

    Regards,

    John
     
  18. PlanetTimmy

    PlanetTimmy

    Joined:
    Mar 13, 2010
    Posts:
    117
    Hi John,
    Thanks for the kind words! As for your questions: I'm not familiar with UScript, but I'll try and help.

    The prefab shooter component has a field called 'Firing Message' that, if set, sends a message every time the gun is fired. You could create a component with a method called 'OnGunFired' (or something like that), and put it on the turret. You could then use that to trigger a particle system for the muzzle flash, and you could also use it to switch the prefab over every five shots.

    My guess the code would look something like this: (Warning! Untested!)

    Code (csharp):
    1.  
    2. public class FireReaction : MonoBehaviour
    3. {
    4.     public ParticleSystem m_muzzleFlash;
    5.  
    6.     public GameObject m_normalShotPrefab;
    7.     public GameObject m_tracerShotPrefab;
    8.  
    9.     public int m_tracerPeriod = 5;
    10.  
    11.     public void OnGunFired()
    12.     {
    13.         m_muzzleFlash.Play();
    14.  
    15.         if (m_shotCount == 0)
    16.         {
    17.             GetComponent<PrefabShooter>().m_bulletPrefab = m_tracerShotPrefab;
    18.         }
    19.         else
    20.         {
    21.             GetComponent<PrefabShooter>().m_bulletPrefab = m_normalShotPrefab;
    22.         }
    23.  
    24.         m_shotCount = (m_shotCount + 1) % m_tracerPeriod;
    25.     }
    26.  
    27.     private int m_shotCount = 0;
    28. }
    Does that help?

    Cheers, Tim
     
  19. NavpointSoftware

    NavpointSoftware

    Joined:
    Apr 30, 2011
    Posts:
    102
    Hi Tim,

    Thanks for the code, awesome stuff.

    The tracer section works like a charm.

    The muzzle flash part I just can't seem to get it going.

    Ive tried a range of particles just to make sure its not the particle set-up but Im getting absolutely nout, and id expect to see something on one of the particle systems ive tried...

    Ive also tried to add a muzzle flash light (like abit of light! :)) by using m_muzzleLight.enabled = true. This works, but ive been trolling around trying to find the code to turn it off again so it flashes, with no luck! :(

    Its not all been a complete failure though on my part. I did mange to edit the above so empty shell cartridges spat out the gun as it was firing. using this:-

    Code (csharp):
    1.       if (m_shotCount == 0)
    2.         { Instantiate(m_EmptyShellPrefab, m_Cartridgethrowpoint.transform.position, Quaternion.identity);
    3.         }
    4.         else
    5.         {
    6.       Instantiate(m_EmptyShellPrefab, m_Cartridgethrowpoint1.transform.position, Quaternion.identity);
    7.         }
    (my current gun is 2 barreled, might have to try an array or something to optermise since I do have several multi-barreled guns in my game)

    Ive broke it again since, but hey, its almost close to the complete package my inner realism whore craves! :cool:

    Again cheers for the help!

    John
     
  20. MrDude

    MrDude

    Joined:
    Sep 21, 2006
    Posts:
    2,569
    I tried a turret system before and although it did it's job well, in order to incorporate it into my existing project I had to add extra scripts to my projectiles to allow them to be used by the turret system, alter the way my projectiles were spawned by having my ships send extra info to the guns to send to the projectiles, which meant changing what info was available on the fighters and since some of them were AI and others were humanoid I also had to write subclasses to create fake values where necesarry and override classes from the initial class and so on and so on and so on...

    All and all, all the turret did was "When an enemy is in range, point at it, then fire a projectile" but to use it I had to change almost the entire game... The end result was a game that was so bloody clunky and messy and just plain ugly in terms of code that I stopped the project completely... I still need a turret system but I definitely don't want to use that one again and said I'd just do it myself and get it over and done with...

    Your muzzle flash and aim ahead components make you sound very interesting, though... as does the one comment about how easy your system is to use... So my question to you is simply this: How intrusive is your system when adding it to an existing project?

    Is it completely modular and I can just drop your prefab onto my destroyer, specify my own projectile to launch and boo, I am done? Or will you require that the projectiles have a specific script attached, demand that the enemy have a specific script attached, have projectile AI that is dependent on your code etc etc etc etc... Exactly how simple is this to add to an existing project?
     
  21. John-G

    John-G

    Joined:
    Mar 21, 2013
    Posts:
    1,122
    @Bronco Did you manage to get your code changes working? If so could you share your code changes :)

    Is it possible for this asset to have different turrets track different targets or do they automatically attack the closest enemy.
    What I mean is it possible to set different turret types to attack different targets that can be set by threat level.
    Eg if I have a Heavy Turret and a machine gun, I would like the Machine Gun to target light armoured enemy's first and not heavy armoured enemy's, and visa versa for the Heavy Turret.
     
  22. PlanetTimmy

    PlanetTimmy

    Joined:
    Mar 13, 2010
    Posts:
    117
    Hi John,

    The Targeter component of the AutoAim system can be used to make the turret choose appropriate targets. It does this by looking for objects with a particular tag. Therefore you could tag all your heavy targets 'heavy' and light ones 'light', and set the target tag appropriately for each type of turret.

    Cheers,

    Tim
     
  23. John-G

    John-G

    Joined:
    Mar 21, 2013
    Posts:
    1,122
    Thanks for reply. Is it possible also to set levels of attack per Tag. So to give priority levels per Tag, that way if the Heavy Turret kills all Heavy Armoured targets it will then attack the light armoured targets?
     
    Last edited: Apr 21, 2013
  24. jashan

    jashan

    Joined:
    Mar 9, 2007
    Posts:
    3,307
    This looks very nice - thank you for making it available on the Asset Store. I'll probably buy this for Traces of Illumination once I continue working on that project (I have one level planned which actually does have turrets ;-) ). So that'll save me some time :)
     
  25. NavpointSoftware

    NavpointSoftware

    Joined:
    Apr 30, 2011
    Posts:
    102
    Hey guys,

    Sorry for dropping this.

    Been working on a couple of other aspects of my project.

    PlanetTimmy - I managed to get the muzzleflashes working, my fault. The prefab I was using had a destroy script on it meaning it only ran once...got rid of that and everything worked fine. :)

    John G. - Im pretty much only using what Planet Timmy posted previously to do with the cartridge casings. I also modified the shell count script to suit my needs. but otherwise the package im using is AutoAim + The cartridge script.

    Ive also just reviewed this on the asset store as Ive done quite abit of experimenting and the arcing fire modelling for me makes this an essential package.

    Regards,

    John
     
    Last edited: Apr 22, 2013
  26. John-G

    John-G

    Joined:
    Mar 21, 2013
    Posts:
    1,122
    Cheers Bronco, will try it out myself. Thanks for the casing idea, would never of thought of it myself.
    Yes the Parabolic curve for shells was the big one for me getting the asset.
     
  27. NavpointSoftware

    NavpointSoftware

    Joined:
    Apr 30, 2011
    Posts:
    102
    Hi again,

    Got another question Tim.

    Hopefully the last as Ive covered pretty much all my required bases.

    Im just wondering if there is a way to add animations to the turret when the Aimer script is active.

    For example my turret is a naval gun and I have training wheels that turn when the gun is Elevating or the swivel component is rotating (I ultimately want a couple of characters actually turning the wheels at a later stage).

    What would be the best way of implementing this functionality?

    Thanks In Advance!

    John
     
  28. PlanetTimmy

    PlanetTimmy

    Joined:
    Mar 13, 2010
    Posts:
    117
    Hi John,
    I think I'd probably write a script something like this: (WARNING: just written off the top of my head - UNTESTED!)

    Code (csharp):
    1.  
    2.  
    3. public class FollowTargetRotation : MonoBehaviour
    4. {
    5.     public enum Axis
    6.     {
    7.         AxisX,
    8.         AxisY,
    9.         AxisZ
    10.     }
    11.    
    12.     public Axis InputAxis = Axis.AxisX;
    13.     public Axis OutputAxis = Axis.AxisX;
    14.    
    15.     public Transform Target;
    16.    
    17.     public float RotationScale = 1.0f;
    18.    
    19.     void LateUpdate()
    20.     {
    21.         float angle = 0.0f;
    22.         switch(InputAxis)
    23.         {
    24.             case Axis.AxisX:
    25.                 angle = Target.transform.localEulerAngles.x;
    26.                 break;
    27.             case Axis.AxisY:
    28.                 angle = Target.transform.localEulerAngles.y;
    29.                 break;
    30.             case Axis.AxisZ:
    31.                 angle = Target.transform.localEulerAngles.z;
    32.                 break;
    33.         }
    34.        
    35.         angle *= RotationScale;
    36.        
    37.         Vector3 outAngles = transform.localEulerAngles;
    38.         switch(OutputAxis)
    39.         {
    40.             case Axis.AxisX:
    41.                 outAngles.x = angle;
    42.                 break;
    43.             case Axis.AxisY:
    44.                 outAngles.y = angle;
    45.                 break;
    46.             case Axis.AxisZ:
    47.                 outAngles.z = angle;
    48.                 break;
    49.         }
    50.        
    51.         transform.localEulerAngles = angle;
    52.     }
    53. }
    54.  
    55.  
    Probably not be the most efficient way to do it, but the code is simple and easy to understand, and the performance should be 'good enough'.

    Takes the rotation from one axis of the target transform and multiplies it by a scaling factor, before applying it to an axis on the gameobject's transform.

    I hope that helps!

    Cheers,

    Tim
     
  29. NavpointSoftware

    NavpointSoftware

    Joined:
    Apr 30, 2011
    Posts:
    102
    Cheers!

    Though im getting an error right at the bottom.
    Code (csharp):
    1.  
    2. transform.localEulerAngles = angle;
    Ive tried afew things with my very limited knowledge but they haven't worked....since the angle has already been broken down to individual floats im not sure if theres another mistake somewhere.

    Many Thanks for the help!

    John
     
  30. PlanetTimmy

    PlanetTimmy

    Joined:
    Mar 13, 2010
    Posts:
    117
    Gah! I'm sorry John - I seem to have missed your post when you first made it :(

    Anyway, what I should have written was:

    Code (csharp):
    1.  
    2. transform.localEulerAngles = outAngles;
    3.  
     
  31. Shinugami

    Shinugami

    Joined:
    Oct 17, 2012
    Posts:
    54
    I have an issue where the game is in JS and I'm using the C# AutoAim code. The problem occurs only in build mode. In the editor mode it does not occur. If one spaceship with an autoaim turret destroys another spaceship which also has an autoaim turret, it causes the game to freeze and crash. The error log says:

    Code (csharp):
    1. Read from location ffffffff caused an access violation.
    I'm assuming this has something to do with the C# being compiled before the JS and some of the scripts on the objects being in JS.

    I've tried translating the C# into JS but with horrible results. Is there a JS version of AutoAim? and if not, can I pay someone to translate it for me?
    This is for a title that will be sold so any help would be appreciated.
     
  32. PlanetTimmy

    PlanetTimmy

    Joined:
    Mar 13, 2010
    Posts:
    117
    Hi Shinugami,
    Which platform are you building to? (e.g. PC Standalone / OSX Standalone / iOS / Android etc)

    Also, have you checked in the editor when you run to see if you're getting any errors or warnings in the console when you run? The description you give of the error isn't enough to diagnose what the problem may be :-(

    Cheers,

    Tim
     
  33. Shinugami

    Shinugami

    Joined:
    Oct 17, 2012
    Posts:
    54
    Hi Tim,
    Yes, I left out the details so as not to give too much information as I feel I have narrowed it down to the C# and JS being out of sync as there are no errors in play mode, even if it sits their for an hour+.
    I can provide a list of warnings however they are all non-important Implicit downcasts and a few variables that are not used. There are no errors in the editor and the conditions do not create the crash in editor mode. Only once the game is built does it produce the error. I might be incorrect (because i'm sure unity compiles it all into the same language) but I assume it's because of the C# doing something that the JS hasn't caught up with.

    It's going to be for PC standalone.

    If you need any other info I'll be happy to provide it. If you want the actual game files I can send them to you.
    Scott
     
    Last edited: Feb 26, 2014
  34. PlanetTimmy

    PlanetTimmy

    Joined:
    Mar 13, 2010
    Posts:
    117
    Hi Scott,
    I'd be surprised if this is a C# / JS interfacing problem - they both get compiled down to the same intermediate bytecode once the game is built anyway.

    To be honest I'm a bit mystified - AutoAim itself doesn't do anything special - it's just all plain old managed C# code.

    Is the development build checkbox ticked when you build? Have you tried that? It's possible we might get more information to help us diagnose the error.

    Cheers,

    Tim
     
  35. Shinugami

    Shinugami

    Joined:
    Oct 17, 2012
    Posts:
    54
    Hi Tim, I removed my modified versions of Auto-Aim and tried just original - unaltered AutoAim turrets and the error still occurs. I did do developer build however I have no idea how to use that mode to be more productive. Observing the graphs I could not see anything outstanding or obvious to hint as to why it crashes.
    The error logs are identical to non-developer mode. If I remove the Auto-Aim turrets then there is no error. If I had to note one thing that did stand out I would say the 'WaitForTargetFPS' which I have no idea what it is, I'm assuming it's part of AutoAim and related to targeting.

    I can send you the game files or put in on Google-drive if you want to check it out. If the error is non-AutoAim related I can pay you for your effort. (if you're expensive then I might need to pay in a few payments).

    Scott
     
    Last edited: Feb 26, 2014
  36. PlanetTimmy

    PlanetTimmy

    Joined:
    Mar 13, 2010
    Posts:
    117
    Hi Scott,
    I can have a quick look in to it for you tonight - I've sent you a PM so we can work out the details.

    Cheers,

    Tim
     
  37. Shinugami

    Shinugami

    Joined:
    Oct 17, 2012
    Posts:
    54
    Hi Tim, provided the game files but haven't heard from you for 2 weeks. A simple reply of any kind would have been nice. Don't mind if you are too busy but it's never a great thing when people don't do as they say.

    If you cannot check your AutoAim code then I'll just have to not include the code in the final game. As an example of the issue: if we have two teams of AutoAim Turrets and one team kills one of the other team then an error is produced in build mode.

    Have a feeling the Error is to do with calculations being made and when the target is destroyed this is producing a null reference of some kind. No null reference appears in the editor and no error appears in the editor. It happens only in build mode and only if I use AutoAim. If I do not use AutoAim then there is no error at all and the game fun.

    I made my own code that does everything EXCEPT that my code at present does not rotate correctly with the parent. I've been working on another game while waiting to hear from you about the AutoAim code. If you need a broken down version of the problem I can make a minimalist scene and recreate it for you.

    Although the sample I gave you was part of a prototype with a mix of some publicly available files, a large portion of the code and artwork were my own. Regardless of the level of skill in my art/code I ask that you delete the files once you have finished with them.

    Thanks,

    Scott
     
    Last edited: Mar 14, 2014
  38. PlanetTimmy

    PlanetTimmy

    Joined:
    Mar 13, 2010
    Posts:
    117
    Hi Scott,
    I'm very sorry this is still causing you a problem, but I haven't actually received any files form you yet! How did you try to send them to me?

    Cheers
     
  39. Shinugami

    Shinugami

    Joined:
    Oct 17, 2012
    Posts:
    54
    In private message we agreed to use Google Drive and I sent you a link. I sent you an further message to ask you to advise me if you could successfully download the file. I'll prepare a minimalist version of the game this time so it's much smaller and easy to see that the issue is with Auto Aim. I just recently took the file down because I did not hear from you. I will set it up again.
    I'll send you the link soon.
    Scott
     
  40. PlanetTimmy

    PlanetTimmy

    Joined:
    Mar 13, 2010
    Posts:
    117
    I do apologise Scott, I have just found the messages you left me. For some reason I didn't get any notifications that you'd PMed me. I'll have a look once you send me the link again.

    Cheers,

    Tim
     
  41. Shinugami

    Shinugami

    Joined:
    Oct 17, 2012
    Posts:
    54
    No worries Tim. I have some good news for both of us. I started off by creating a totally new project with Just the AutoAim turrets. I could not reproduce the error (Previously I did create a new project but with old code as it seemed functional because there was no errors). So I exported these objects into my new project. Again, the error does not occur. So atleast I have concluded that the problem is not with AutoAim. There must be some other issue with my existing project that only occurs with AutoAim.
    So, I'll restate this:
    1) Error occurs in my work project when I use AutoAim. Not Great :(
    2) If I create the same kind of Objects (with same Hierarchy of parents etc) in a new Project using AutoAim turrets, the error does not occur upon destroying an object that contains AutoAim turrets. Even if enemy teams are firing at each other or the same target. Great!
    3) Importing these working objects into my new project and using them DOES NOT produce the error. Great!

    So your product is great as always. It seems for some reason my objects which have extra code are causing a problem when AutoAim is used. I'll gradually move the code onto these new imported objects and see if I can pinpoint where there is an issue. There are no errors or null references in editor mode. It only crashes in build mode if I destroy my OLD objects while they are using AutoAim.
    I'll post an update if I can work out where the compatibility of my code is causing the problem.
     
    Last edited: Mar 14, 2014
  42. PlanetTimmy

    PlanetTimmy

    Joined:
    Mar 13, 2010
    Posts:
    117
    Okay, well give me a shout if you need a hand.
     
  43. PlanetTimmy

    PlanetTimmy

    Joined:
    Mar 13, 2010
    Posts:
    117
  44. roger0

    roger0

    Joined:
    Feb 3, 2012
    Posts:
    1,208
    Hello. I purchased auto aim yesterday. But I immediately found a problem. The aim ahead function does not work with my planes. It just shoots right at it and always misses. I found in the demo scene that the turret has issues with tracking non kinematic rigidbodys. The planes in my game are not kinematic and use gravity. They must remain like that in order for them to function. I am using the AI planes that come with the airstrike starter kit. Please help.
     
  45. PlanetTimmy

    PlanetTimmy

    Joined:
    Mar 13, 2010
    Posts:
    117
    Hi Luke,
    I can't tell offhand what's going wrong - the test scene I use for testing non-kinematic rigidbodies (ParabolicTracker) seems to be tracking the targets correctly. At a guess, it'll be one of the following things:

    a) The projectile is type is set to 'Instant', in which case no aim-ahead is performed
    b) The projectile speed is for some reason out of whack with the projectile speed entered in the aiming component
    c) The code is for some reason incorrectly calculating the velocity of the target

    I can have a look at your scene if you'd like to see if I can work out what's going on.
     
  46. roger0

    roger0

    Joined:
    Feb 3, 2012
    Posts:
    1,208
    I think I downloaded a older version of the package since I got a different turret than what was in the demo webplayer. I downloaded the newer version and It seems to be working now. I tested it with the airstrike package and with a little tweaking, can hit the planes.

    However, if I adjust the bullet speed from 100 to 1000 in the parabolic test scene, the turret can no longer hit the target. I'm wondering if the turret system can account for the bullet speed and adjust its aim ahead function accordingly.
     
  47. PlanetTimmy

    PlanetTimmy

    Joined:
    Mar 13, 2010
    Posts:
    117
    I'm not sure quite what's going on here, as if I try the parabolic test scene and set the bullet velocity to 1000, it hits the target with no problem.

    I recommend you use AutoAim_v1.04_2012_09_08 if you've got it direct from my website, as that's the most recent version.
     
  48. roger0

    roger0

    Joined:
    Feb 3, 2012
    Posts:
    1,208
    heres the versions I downloaded

    AutoAim_2012_09_08-12-14

    AutoAim_2012_04_24

    is AutoAim_2012_09_08-12-14 the correct one?
     
    Last edited: Apr 27, 2014
  49. roger0

    roger0

    Joined:
    Feb 3, 2012
    Posts:
    1,208
    It looks like the reason for it missing was because I was changing the bullet speed value after the game has started. Now its a killing machine. Great package, thanks!
     
  50. roger0

    roger0

    Joined:
    Feb 3, 2012
    Posts:
    1,208
    It appears that the firing pause is connected to target distance. When I set firing pause to something like 0.0001, it fires at a slow rate when the target is far away. But once it gets close, it fires extremely fast. Is this a known issue, and is there a way to make the fire rate constant regardless of distance?