Search Unity

  1. Welcome to the Unity Forums! Please take the time to read our Code of Conduct to familiarize yourself with the forum rules and how to post constructively.
  2. We have updated the language to the Editor Terms based on feedback from our employees and community. Learn more.
    Dismiss Notice

AVK | Assault Vehicle Kit

Discussion in 'Assets and Asset Store' started by whebert, Feb 11, 2015.

  1. whebert

    whebert

    Joined:
    Mar 9, 2013
    Posts:
    72
    Hey closetgeekshow, thanks for considering AVK. I'm finalizing version 1.1 right now and will be submitting it very soon. After I submit 1.1, I will switch to getting AVK Unity 5 compatible. It is the next thing on my list of priorities. I don't exactly have a timeline for the Unity 5 compatibility, but I hope it won't take too long. I'll post updates here as I go.
     
  2. closetgeekshow

    closetgeekshow

    Joined:
    Jun 6, 2014
    Posts:
    122
    Thanks for the update, I'll move on to non-driving related features while I wait.
     
  3. dexxy

    dexxy

    Joined:
    Jun 16, 2015
    Posts:
    12
    Great work! I'm waiting for the Unity 5 update to buy.
     
  4. whebert

    whebert

    Joined:
    Mar 9, 2013
    Posts:
    72
    Version 1.1 has been submitted. I will post again when it has passed review (assuming there are no issues).

    Now to focus on Unity 5 compatibility.
     
  5. closetgeekshow

    closetgeekshow

    Joined:
    Jun 6, 2014
    Posts:
    122
    Yay! I cannot wait :)
     
  6. dexxy

    dexxy

    Joined:
    Jun 16, 2015
    Posts:
    12
    go go go :)!
     
  7. chrisabranch

    chrisabranch

    Joined:
    Aug 15, 2014
    Posts:
    146
    do you have documentation on adding a deferent AI/ Player car?
     
  8. whebert

    whebert

    Joined:
    Mar 9, 2013
    Posts:
    72
    Hmm, I didn't get an email when you posted the above question, chrisabranch, sorry for the delay in responding.

    The package does contain documentation on how to create a custom Vehicle component (with code) that could be swapped into the system and driven either by the AI or the player. However, one easy way to make a custom Vehicle is to borrow one of the example prefabs (like the assault buggy in the demo) and simply replace the vehicle model parts with your own favorite vehicle parts (body, wheels, etc.). You could then just tweak some of the parameters to your liking. I didn't necessarily document how to do this as it should be fairly straight forward.

    The documentation mostly describes how to extend the base Vehicle type so that newly derived vehicles will handle the inputs provided by AI or the player controllers. With this system, you could even integrate other vehicle systems into AVK (like Edy's Vehicle Physics, Randomation Vehicle Physics, Realistic Car Controller, etc.) and have any of the vehicles in those systems respond to the modular driving controllers in AVK. I was actually thinking of doing this at some point to demonstrate the modular nature of AVK...
     
    SpaceRay likes this.
  9. whebert

    whebert

    Joined:
    Mar 9, 2013
    Posts:
    72
  10. mudkills

    mudkills

    Joined:
    Nov 1, 2014
    Posts:
    2
    I've been messing with the demo, and I was reading all the other comments, and thought that its reasonable for the cars to shoot backwards, and that can be hard, but the roller bot things shouldn't be able to shoot backward, maybe you could add a manual driving option to the car, so the gun shoots by itself, as a separate option. like the different steering options.
     
  11. Jenovah

    Jenovah

    Joined:
    Dec 9, 2011
    Posts:
    14
    Great Kit!

    I recently purchased the AVK but one thing I can't seem to figure out is how the heck do I replace the default explosion particle when you destroy the enemy AI buggies I figured it would be attached to AssaultBuggy_Destroyed.prefab, but I can't figure out where it is. :p

    Any help would be greatly appreciated :)

    -J
     
  12. whebert

    whebert

    Joined:
    Mar 9, 2013
    Posts:
    72
    mudkills,

    Cool idea, I like it. I could add a "Bot Path Follower" for a steering controller that would auto drive the player's vehicle along some path (the long one) while the player just controls the shooting. Or inversely, I could add a "Bot Shooter" aiming controller that auto shot at enemies so the player could just drive. Either way, both.

    Also, the AI components had a setting adding to them so that you can set them to not be able to shoot behind them. If you select one of the AI vehicle prefabs, there is a "Max Angle To Target" setting that controls how far off their forward vector they can aim and shoot at. I left the default at 180 degrees, so they can still shoot behind them, but you can put like 45 or so and they'd only be able to shoot in front.
     
  13. whebert

    whebert

    Joined:
    Mar 9, 2013
    Posts:
    72
    Thanks Jenovah!

    You are correct, the explosion is attached to the AssaultBuggy_Destroyed prefab. If you drag one of those into the scene you should see an "Explosion" child object of the main prefab. Inside the Explosion object is the sound and particles that make up the explosion. You should be able to replace that and then save (Apply) the changes to the prefab, or rename and save it to a new one if you like and change the "Death Prefab" reference in the AI Buggy main prefab. That should allow you to see a different explosion when they are destroyed.
     
  14. workingman247

    workingman247

    Joined:
    Jul 25, 2015
    Posts:
    11
    Very interested in your Assault Vehicle Kit, and I understand that you are intending to do a Unity5 compatible upgrade. Will this update be free to individuals that have already purchased your system ? I want to purchase,, but want the Unity5 compatible version when available.
     
  15. whebert

    whebert

    Joined:
    Mar 9, 2013
    Posts:
    72
    Yes, workingman247, the update to Unity 5 compatibility will be a free update.
     
  16. closetgeekshow

    closetgeekshow

    Joined:
    Jun 6, 2014
    Posts:
    122
    How's the Unity 5 update coming along? Just checking in, don't mean to be a pain
     
    SpaceRay likes this.
  17. whebert

    whebert

    Joined:
    Mar 9, 2013
    Posts:
    72
    Hey closetgeekshow, thanks for asking - no pain at all. I'm still working on it when I'm able, so it's coming along. I have several projects going on that I switch between in order to pay the bills, so progress isn't as fast as I would like. I'll post here when I have more info.
     
    SpaceRay likes this.
  18. closetgeekshow

    closetgeekshow

    Joined:
    Jun 6, 2014
    Posts:
    122
    I get that entirely :) Thanks for the update
     
  19. MachoBrizzin

    MachoBrizzin

    Joined:
    Jul 10, 2013
    Posts:
    27
    Any updates on this? :D How's it coming with the flying mechanics mentioned earlier? :) Most likely going to pick this asset up soon, as I really need a stepping stone for vehicles like this.
     
  20. whebert

    whebert

    Joined:
    Mar 9, 2013
    Posts:
    72
    Hey DaAwsumPider,

    I'm still working the Unity 5 compatibility for AVK when I'm able. I've had to put AVK development on the back burner temporarily to take care of some other priorities (pay the bills), but will be getting back to it as soon I can. I know it has been a while since I've updated, and I hate that. But your interest in AVK makes me want to get back to it right away. Thank you.
     
  21. SpaceRay

    SpaceRay

    Joined:
    Feb 26, 2014
    Posts:
    455
    Happy new year 2016! i send you my best wishes

    Hello, I have found this asset that seems to be very good and well done, and I like the demo and the multiple controls available that work well and are great. And I think that this is really what I want and need

    The reason I am wrting here is that I have 4 questions before buying this:

    1 - NEXT UPDATE - It is told that is not really compatible with Unity 5.3 until it is released the next update, so I want to know if it will work without problems in 5.3 when the update is available? And is there any possible estimated date? One week, 15 days, one month, or more for the update?

    2 - GAME FOR MOBILE - I want to make a game for iOS and Android so I would need some digital touch screen controllers, so I want to know if this will have any kind of mobile controllers or if it is compatible with any additional mobile touch controllers ypu may know

    3 - DEMOLITION DERBY GAME - I want to make a game where there will be about 15 cars in an enclosed scenery (not a racing) where they have to try to survive destroying the other 14 opponents, so the last one that is alive is the winner. For this you would have around 9 different weapons and also able to crash into them. it will NOT be 14 opponents against the player, it will be everybody VS everybody

    4 - CODING OR SCRIPTING NEEDED? I want to know also if for using and customizing this kit into my own game as told on point 3, it would require that I make any coding or scripting as I do not have the knowledge and experience with these. And also want to know if it is explained the documentation for beginners.


    What I want to know is if the AI included is able to make the cars fight between themselves, and able to follow and attack other AI cars and destroy them, and also of course attack with weapons and crashing into the player.

    Thanks very much for your help

    Waiting for your answer I send you my best regard
     
    Last edited: Jan 2, 2016
  22. whebert

    whebert

    Joined:
    Mar 9, 2013
    Posts:
    72
    Hello SpaceRay, and Happy New Year 2016 to you as well!

    Very good questions, let me answer them individually.

    1. AVK is not entirely compatible with Unity 5.x yet as the wheeled vehicle (Assault Buggy, who's physics was built under Unity 4) acts a bit wonky under Unity 5's new physics system. All other aspects of AVK should be fine under Unity 5 - just the wheeled vehicle needs to be updated. I have been working on this when time permits, but have had to take on other work for a while now in order to pay the bills, etc. I do not have an estimated date at this time, unfortunately.

    2. The package does not currently include any mobile touch controllers. However, since the controllers (camera, steering, and aiming/shooting) are of modular design, in that they can be swapped in and out with relative ease (see the demo), it shouldn't be difficult to implement mobile touch controllers. I have had some ideas about doing this, just haven't gotten around to it yet (see note 1 above :\). Whether you would make mobile controllers from scratch or use some from another package or Unity demo, it would still require at least some small coding to transfer the input to AVK's camera/steering/aiming controller scheme.

    3. Cool, sounds fun.

    4. From the description of your demolition derby game, it does sound like there might need to be some coding to get the AI vehicles to operate to your specific scenario. As they are currently in the demo scene, the AI vehicles will shoot and try to destroy each other, like you want. But they are basically simple path following AI that shoot at each other, they don't know how to ram or follow each other, or to try avoid being hit themselves, so that would have to be implemented.

    The documentation does describe how to work with and even extend the basic components of AVK, like Vehicles, Turrets, the player controllers (camera, steering, aiming), etc. The AI scripts just use these components to make the vehicles do what they do and the samples in the demo scene should be fairly simple and easy to augment. But yes, although the AI does shoot at each other, it would likely need to be augmented to make them act correctly in your demolition game.

    Hope that answers your questions.
     
    SpaceRay likes this.
  23. SpaceRay

    SpaceRay

    Joined:
    Feb 26, 2014
    Posts:
    455
    Thanks very much for your answers, sorry much for the delay in answering, because I was trying and testing other possible options as you said that for what I wanted I need to modify the scripts, and now I have a person that can do that for me and he thinks he can modify your AVK for me.

    I hope and wish I can be able to buy, use and enjoy your well done AVK if you can answer to the following questions that is what I need to decide to buy it.

    Can I use any kind of 3D model vehicle? I mean one that may be found here on the Unity asset store.
    Is there any limitation on what vehicle can be used?
    What needs to have the vehicle model to be used with AVK? either as player or enemy

    I have just seen this text shown here and this seems to be very important and could change much the way AVK may be used.

    Please could you be so kind to tell how other vehicle systems can be integrated with AVK?

    I own the Edy´s vehicle and do not know and understand how this could be "mixed" with AVK.
    Is there any instruction or tutorial to know how to do this?

    Could I then use a vehicle configured with Edy´s vehicle features inside AVK with the controls of AVK? Sorry that I do not know how the integration of other systems could work, so this is why I am asking if you can be so kind to explain it more.

    TESTED FOR MOBILE?

    I told above that I want to use this for mobile, but do not know if this really has been tested for mobile and would have a good perfomance in tablets.

    Thanks very much for your help
     
    Last edited: Jan 19, 2016
  24. whebert

    whebert

    Joined:
    Mar 9, 2013
    Posts:
    72
    Pretty much, yes. There are only 2 example vehicles included in the package currently, however, so the included vehicle controller scripts are only designed for those types of vehicles. Although AVK can utilize other vehicle controller scripts, even external ones, into the overall system so you could use AVK's camera/steering/aiming controllers with them (more on this later).

    The included spherical RollerBot is just a spherical rigidbody being rolled around and was included to demonstrate how you could have something very different from a wheeled vehicle within AVK's overall system.

    The wheeled vehicle (Assault Buggy) is probably more like what you are wanting. If you like how the Assault Buggy handles and drives around, which was tweaked for more of a fun and fast paced driving and shooting type game - similar to Borderlands or Halo - then you could use that vehicle as a basis and swap out the included model with another. So yes, you could easily purchase another wheeled vehicle type model from the asset store and swap its visual components (chassis, wheels, turrets if any, etc.) with the Assault Buggy's. I've seen numerous users do this, some have posted pictures in this forum (see earlier posts from SecretStudio and SmokeyKilla).

    Assuming you would want to do this, you could use AVK's modular camera, steering, and aiming controllers to drive (and shoot if applicable) another systems vehicles, like Edy's very realistic vehicles. Perhaps you'd like to use the Borderlands/Halo type of camera steering to drive around with so that the vehicle smoothly follows the direction you're looking. This would require some scripting to bridge the two, of course, but you would essentially need an adapter that took AVK's inputs and then sent those messages on to the other system. The easiest way would be to extend the basic AVK Vehicle class, say to an EdyVehicle, that accepted the AVK Vehicle input and provided the necessary information, plop that script onto the Edy vehicle and then translate the AVK input into Edy's input. I really need to do this with Edy's system to demonstrate what I'm talking about. And of course you'd have to have a license for the other system, along with AVK, in order to integrate the two.

    AVK has not been tested yet for mobile. Probably because I haven't made any mobile touch based controllers to drive around with yet. The only thing I can think of that might cause any issues would be the sample terrain, which uses Unity's terrain system, which I hear sometimes has issues on mobile. Other than that, I don't think there is any part of the system that should be overly taxing on mobile. But again, I haven't tested it on mobile yet, so I could possibly be wrong on this.

    Hope that answers your questions.
     
    SpaceRay likes this.
  25. whebert

    whebert

    Joined:
    Mar 9, 2013
    Posts:
    72
    And just to clarify and make sure, AVK is not yet compatible with Unity 5!

    I have actually been able to work on this a little lately, we shall see how it goes. I'm just having issues getting the wheeled vehicle (Assault Buggy) to drive around with the same type of feel as it had under Unity 4 - not nearly close enough yet. Kinda miss the WheelColliders in Unity 4, seemed so much easier to work with...
     
  26. SpaceRay

    SpaceRay

    Joined:
    Feb 26, 2014
    Posts:
    455
    Thanks very much for your fast and well detailed and explained answer. I have told this to the programmer I have and will know if he could be able to mix both controllers. it was very helpful. Will tell you more later.
     
  27. whebert

    whebert

    Joined:
    Mar 9, 2013
    Posts:
    72
    OK, so I went ahead and made an AVK and Edy's Vehicle Physics Integration Demo.

    This is to demonstrate that other vehicle packages, like Edy's Vehicle Physics, can be integrated into AVK if so desired. So all the controls are the same as in the standard AVK demo (H key for help menu for list) and you can drive EVP's cars around with the modular camera/steering/aiming controllers. I even put turrets on some of them for fun - Tab key to cycle through the different vehicles.

    And the following is the script that bridges the two. I just put this script on the EVP vehicle prefabs, along with Entity and EntityRegen (Health and Shield) and was good to go... well, first, I did have to put Edy's .js scripts into a top level "Standard Assets" folder so they would compile first and my C# code could then access it.

    Code (CSharp):
    1. using UnityEngine;
    2. using System.Collections;
    3.  
    4. using hebertsystems.AVK;
    5.  
    6. [RequireComponent(typeof(CarControl))]
    7. public class EdyVehicle : SteerableVehicle {
    8.  
    9.     public float orbitCameraPivotHeight = 2.5f;                    // The orbit camera pivot height above the position of the vehicle.
    10.     public float maxTurnSpeed = 180f;                            // The maximum turn speed (angles per sec) of the steering system.
    11.     public float maxTurnSpeedAtMax = 45f;                        // The maximum turn speed at vehicle max speed.
    12.  
    13.     public float currentMaxTurnSpeed
    14.     {
    15.         get
    16.         {
    17.             float t = Mathf.InverseLerp(0, carControl.maxSpeed, mRigidbody.velocity.magnitude);
    18.             return Mathf.Lerp(maxTurnSpeed, maxTurnSpeedAtMax, t);
    19.         }
    20.     }
    21.  
    22.     public override Vector3 orbitCameraPivotBase                 // The pivot base for orbiting cameras.
    23.     {
    24.         get
    25.         {
    26.             return transform.position;
    27.         }
    28.     }
    29.  
    30.     public override Vector3 orbitCameraPivotOffset                 // The offset from the pivot base for orbit camera pivot point.
    31.     {
    32.         get
    33.         {
    34.             return Vector3.up * orbitCameraPivotHeight;
    35.         }
    36.     }
    37.  
    38.     public override Vector3 forward     {get{return transform.forward;}}        // The forward direction of the vehicle.
    39.     public override Vector3 up             {get{return transform.up;}}                // The up direction of the vehicle
    40.     public override Vector3 right        {get{return transform.right;}}            // The right direction of the vehicle
    41.     public override Vector3 position     {get{return transform.position;}}        // The postion of the vehicle.
    42.     public override Quaternion rotation {get{return transform.rotation;}}        // The rotation of the vehicle.
    43.  
    44.     // Process AVK vehicle input
    45.     public override VehicleInput input                                            // Process Vehicle input.
    46.     {
    47.         set
    48.         {
    49.             if(value.forwardThrottle.HasValue) mThrottle = Mathf.Clamp(value.forwardThrottle.Value, -1, 1);
    50.             if(value.handBrake.HasValue) mHandBrake = value.handBrake.Value;
    51.          
    52.             if(value.moveDirection.HasValue) SteerDirection(value.moveDirection.Value);
    53.             if(value.relativeMoveDirection.HasValue) SteerDirectionRelative(value.relativeMoveDirection.Value);
    54.         }
    55.     }
    56.  
    57.     public override float steerAngleCurrent { get{return mSteerAngleCurrent;} }    // The current steer angle of the vehicle (read only).
    58.  
    59.     protected override float steerAngleTarget {
    60.         get{return mSteerAngleTarget;}
    61.         set{mSteerAngleTarget = Mathf.Clamp(value, -edySteerMax, edySteerMax);} }
    62.  
    63.     protected float mSteerAngleCurrent = 0;
    64.     protected float edySteerMax = 45;
    65.     protected bool mHandBrake = false;
    66.  
    67.     // Reference to Edy's car controller
    68.     protected CarControl carControl;
    69.  
    70.  
    71.     protected override void Awake()
    72.     {
    73.         base.Awake ();
    74.  
    75.         // Obtain reference to Edy's CarControl and save the steer max.
    76.         carControl = GetComponent<CarControl>();
    77.         edySteerMax = carControl.steerMax;
    78.     }
    79.  
    80.     void Update()
    81.     {
    82.         DriveVehicle();
    83.     }
    84.  
    85.     protected virtual void DriveVehicle()
    86.     {
    87.         // Move current steer angle towards target at maxTurnAnglePerSec
    88.         mSteerAngleCurrent = Mathf.MoveTowards(mSteerAngleCurrent, mSteerAngleTarget, currentMaxTurnSpeed * Time.deltaTime);
    89.  
    90.         // Calculate relative forward vehicle speed
    91.         float speedForward = Vector3.Dot(mRigidbody.velocity, transform.forward);
    92.  
    93.         // Send input on to Edy's CarControl
    94.         carControl.steerInput = Mathf.Clamp(mSteerAngleCurrent/edySteerMax, -1f, 1f);
    95.         carControl.motorInput = Mathf.Abs(mThrottle);
    96.         carControl.brakeInput = Mathf.Sign(speedForward) == Mathf.Sign(mThrottle) ? 0 : (Mathf.Abs(speedForward) > .5f ? 1 : 0);
    97.         carControl.gearInput = mThrottle < 0 ? -1 : 1;  
    98.         carControl.handbrakeInput = mHandBrake ? 1 : 0;
    99.     }
    100. }
    101.  
     
    Last edited: Jan 25, 2016
    SpaceRay likes this.
  28. SpaceRay

    SpaceRay

    Joined:
    Feb 26, 2014
    Posts:
    455
    Hello, Thanks very much for your help and the conversion of the Edy´s vehicle to be used by AVK, I like much the webplayer and it is very good how it works

    BUT I have tried to follow your instructions to use this script shown above, but I can´t use because it gives me an error

    I have put as you said the Edy´s scripts inside a Standard Asset folder in the root of the Assets folder.

    The name I have given to your script that you have shown above is AVK_Integration.cs. Should I put this script somewhere specific so is recognized the Edy´s?

    Can you be so kind to help?

    thanks very much for your help
     
    Last edited: Jan 23, 2016
  29. whebert

    whebert

    Joined:
    Mar 9, 2013
    Posts:
    72
    Hey SpaceRay, that should work.

    Make sure the folder is specifically named "Standard Assets". Not sure if it was a typo or not above, but you left off an 's' at the end of Assets. Unity won't recognize it as a special folder in that case, must be exact to work.

    But after that, it should be fine. May even want to restart Unity just to make sure.
     
  30. SpaceRay

    SpaceRay

    Joined:
    Feb 26, 2014
    Posts:
    455
    Hello, I have put correctly the "Standard Assets" folder, so I do not think that is the problem, and I know it because the error changes if I put the scripts inside or outside of the Standard assets folder, also if I put your own script given inside the Standard Assets, will give another different error, so I think it recognizes that folder, but anyway I will try again.

    So you say that having all the scripts of Edy's vehicle inside the folder Standard Assets and your own script outside of this folder anywhere else, it should work. so will try again

    Thanks
     
  31. whebert

    whebert

    Joined:
    Mar 9, 2013
    Posts:
    72
    Yes, I think all I did in that respect was to move the Scripts folder inside EdyVehiclePhysics to under a Standard Assets folder. So your folder structure should look like this in the project:

    • Assets
      • AssaultVehicleKit
      • EdyVehiclePhysics
      • Standard Assets
        • Scripts (this is the Scripts folder that was in EdyVehiclePhysics)

    And inside that Scripts folder should be all the Edy .js scripts files, CarControl, CarDamage, CarCameras, etc.
     
  32. SpaceRay

    SpaceRay

    Joined:
    Feb 26, 2014
    Posts:
    455
    please, have you seen my request done by PM ? could you do it? Thanks

    This what you are showing is the same folders order as I have, although for Edy's vehicle I have the folder name EVP5 instead of the EdyVehiclePhysics you have

    For testing, I have made a totally new empty project,

    1- downloaded first AVK and then after downloaded Edy's ( both latest versions)
    2 - Created the Standard Assets folder
    3- moved the whole Scripts folder inside EVP5 (Edy's) to the Standard Assets
    4 - Create new C# script
    5 - copy the script from the forum
    6 - Open the new script in monodevelop and paste the script you have done
    7 - Save it and then I again get the same error

    CarControl is in red in Monodevelop and also the last 5 lines of the script

    i have checked and seen that there is no missing line in the copied script, and all is the same as in the forum

    you have now confirmed to me from last post that I did it right the first time, but anyway, I made everything again from start, and still getting the same error

    Do not know what may be happening or if I am making something wrong or missing something

    Thanks for your help
     
    Last edited: Jan 23, 2016
  33. whebert

    whebert

    Joined:
    Mar 9, 2013
    Posts:
    72
    Ah, sorry, yeah - my integration was done with Edy's version 4.4, not version 5. I think Edy's scripts all changed with EVP5. I'll have to re-integrate that and the EdyVehicle bridge script will possibly be different for EVP5. Let me get back to you on that...
     
  34. whebert

    whebert

    Joined:
    Mar 9, 2013
    Posts:
    72
    Here is the AVK to EVP5 bridging script for Edy's Vehicle Physics version 5. Very similar to the previous one, as you can see, just a tad simpler actually. And no need to move any of the EVP5 scripts as they are in C# just like AVK.

    Just also add an AVK PlayerEntity script as well so the AVK system picks up on the player vehicle at start.

    And either disable or remove the VehcileStandardInput behavior on the EVP5 vehicle as well so that AVK can provide the user input.


    Code (CSharp):
    1. using UnityEngine;
    2. using System.Collections;
    3.  
    4. using hebertsystems.AVK;
    5.  
    6. [RequireComponent(typeof(EVP.VehicleController))]
    7. public class EVP5Vehicle : SteerableVehicle {
    8.  
    9.     public float orbitCameraPivotHeight = 2.5f;                    // The orbit camera pivot height above the position of the vehicle.
    10.     public float maxTurnSpeed = 180f;                            // The maximum turn speed (angles per sec) of the steering system.
    11.     public float maxTurnSpeedAtMax = 45f;                        // The maximum turn speed at vehicle max speed.
    12.  
    13.     public float currentMaxTurnSpeed {
    14.         get {
    15.             float t = Mathf.InverseLerp(0, evp5VehicleController.maxSpeedForward, mRigidbody.velocity.magnitude);
    16.             return Mathf.Lerp(maxTurnSpeed, maxTurnSpeedAtMax, t);
    17.         }
    18.     }
    19.  
    20.     public override Vector3 orbitCameraPivotBase                 // The pivot base for orbiting cameras.
    21.     {
    22.         get {
    23.             return transform.position;
    24.         }
    25.     }
    26.  
    27.     public override Vector3 orbitCameraPivotOffset                 // The offset from the pivot base for orbit camera pivot point.
    28.     {
    29.         get {
    30.             return Vector3.up * orbitCameraPivotHeight;
    31.         }
    32.     }
    33.  
    34.     public override Vector3 forward { get { return transform.forward; } }        // The forward direction of the vehicle.
    35.     public override Vector3 up { get { return transform.up; } }                // The up direction of the vehicle
    36.     public override Vector3 right { get { return transform.right; } }            // The right direction of the vehicle
    37.     public override Vector3 position { get { return transform.position; } }        // The postion of the vehicle.
    38.     public override Quaternion rotation { get { return transform.rotation; } }        // The rotation of the vehicle.
    39.  
    40.     // Process AVK vehicle input
    41.     public override VehicleInput input                                            // Process Vehicle input.
    42.     {
    43.         set {
    44.             if (value.forwardThrottle.HasValue) mThrottle = Mathf.Clamp(value.forwardThrottle.Value, -1, 1);
    45.             if (value.handBrake.HasValue) mHandBrake = value.handBrake.Value;
    46.  
    47.             if (value.moveDirection.HasValue) SteerDirection(value.moveDirection.Value);
    48.             if (value.relativeMoveDirection.HasValue) SteerDirectionRelative(value.relativeMoveDirection.Value);
    49.         }
    50.     }
    51.  
    52.     public override float steerAngleCurrent { get { return mSteerAngleCurrent; } }    // The current steer angle of the vehicle (read only).
    53.  
    54.     protected override float steerAngleTarget {
    55.         get { return mSteerAngleTarget; }
    56.         set { mSteerAngleTarget = Mathf.Clamp(value, -edySteerMax, edySteerMax); }
    57.     }
    58.  
    59.     protected float mSteerAngleCurrent = 0;
    60.     protected float edySteerMax = 45;
    61.     protected bool mHandBrake = false;
    62.  
    63.     // Reference to Edy's VehicleController
    64.     protected EVP.VehicleController evp5VehicleController;
    65.  
    66.  
    67.     protected override void Awake() {
    68.         base.Awake();
    69.  
    70.         // Obtain reference to Edy's VehicleController and save the steer max.
    71.         evp5VehicleController = GetComponent<EVP.VehicleController>();
    72.         edySteerMax = evp5VehicleController.maxSteerAngle;
    73.     }
    74.  
    75.     void Update() {
    76.         DriveVehicle();
    77.     }
    78.  
    79.     protected virtual void DriveVehicle() {
    80.         // Move current steer angle towards target at maxTurnAnglePerSec
    81.         mSteerAngleCurrent = Mathf.MoveTowards(mSteerAngleCurrent, mSteerAngleTarget, currentMaxTurnSpeed * Time.deltaTime);
    82.  
    83.         // Calculate relative forward vehicle speed
    84.         float speedForward = Vector3.Dot(mRigidbody.velocity, transform.forward);
    85.         bool applyBraking = speedForward * mThrottle < -.1f;
    86.  
    87.         // Send input on to Edy's VehicleController
    88.         evp5VehicleController.steerInput = Mathf.Clamp(mSteerAngleCurrent/edySteerMax, -1f, 1f);
    89.         evp5VehicleController.throttleInput = applyBraking ? 0 : mThrottle;
    90.         evp5VehicleController.brakeInput = applyBraking ? Mathf.Abs(mThrottle) : 0;
    91.         evp5VehicleController.handbrakeInput = mHandBrake ? 1 : 0;
    92.     }
    93. }
    94.  
     
    Last edited: Jan 26, 2016
  35. SpaceRay

    SpaceRay

    Joined:
    Feb 26, 2014
    Posts:
    455
    Please, I sent an email for you with some questions.

    Hello, I have tested this new script and is recognized without error, but what is not recognized is the AVK scripts, I mean I tried to make the same as you have done in the webplayer above, I mean to use the Edy´s vehicle scene and car but with AVK.

    I have added the AVK PlayerEntity script and removed the VehicleStandardInput behavior on the EVP5 vehicle

    I may be missing something, or need to add something else.

    thanks for your help
     
  36. whebert

    whebert

    Joined:
    Mar 9, 2013
    Posts:
    72
    OK, so you basically just need the AVK system in another packages scene, EVP5 scene in this case. To get the minimum working, say to just drive around the red truck in EVP5 simple demo scene with AVK system, here's what to do:

    • Have a project with both AVK and EVP5
    • Load the AVK demo scene, DesertDemo
    • Select and copy (Ctrl+C or Edit->Copy) the following scene objects:
      • PlayerPrefabs
      • PlayerDriverCameraRig
      • PlayerRespawner
      • HUD
      • PlayerInput
      • CCTV Camera Positions
    • Load the EVP5 "The City - Simple Scene" scene.
    • Select the scene Hierarchy window and paste (Ctrl+V or Edit->Paste) the AVK objects into the scene.
    • Select the Main Camera object and delete it (AVK PlayerDriverCameraRig already has one).
    • Now, to prepare the L200-Red truck to be driven by AVK:
      • Disable or remove the Vehicle Standard Input script from the truck.
      • Place the EVP5Vehicle script above on the truck (I've updated this, grab the latest above.)
      • If you want a cockpit view, add or select one of the transforms on the truck to act as the cockpit location - drag this to the Cockpit Transform property of the EVP5Vehicle behavior.
      • Add a PlayerEntity script to the truck, modifing the health and shield amounts to your liking.
      • Add EntityRegen scripts (one for health and one for shield) if you want regeneration for those entity stats.
    • The L200-Red truck should now be ready.
    • If you want, save this prefab by hitting Apply or renaming it and saving as a new prefab.
    • Do the above to any of the other vehicles you want to.
    • Add these prefabs to the PlayerPrefabs script if you want to be able to cycle between them by hitting Tab.
    • Save the scene.
    That should be it.
     
  37. sahin09

    sahin09

    Joined:
    Oct 29, 2015
    Posts:
    14
    Hey, I am looking to purchase this asset today, but a big question is will this work with the Realistic Controller asset? Like I have a bunch of cars and would like to add the AI script so they attack other enemy AI and the player as well and tmake sure they follow the AI way-points in a race track but hit at you as well? Is this possible? Thanks
     
  38. whebert

    whebert

    Joined:
    Mar 9, 2013
    Posts:
    72
    Hey sahin09,

    If by Realistic Controller you are referring to the Realistic Car Controller (RCC) from BoneCracker Games, then yes, RCC can be integrated with AVK so that you can use AVK's control system to drive the RCC vehicles. This means that the modular AVK user controls (camera/steering/aiming) as well as AVK's AI can drive the vehicles. The AI examples in AVK are somewhat simple and only follow waypoint paths while shooting at any nearby entities (other AI or the player). If you wanted something more complex than that, the AI scripts would probably need to be augmented a bit. But overall, yes, what you asked sounds possible. And of course you can throw on some turrets so that RCC's vehicles would have weapons for the player or the AI to shoot with.
     
    sahin09 likes this.
  39. whebert

    whebert

    Joined:
    Mar 9, 2013
    Posts:
    72
    Here is the AVK to RCC bridge script below, in case you needed it. Also, the steps to setup a simple scene are similar to the steps outlined above for EVP5, with a few differences. Delete the RCCMainCamera in the scene and disable the RCC Car Camera Config script on the vehicles - think that should do it. Then, add the RCCVehicle script (below) and PlayerEntity (for player vehicles, or just Entity for AI vehicles) and EntityRegen scripts to one of the vehicles to test the setup. Also, make sure to copy the InputManager.asset settings file from AVK ProjectSettings folder to your test project so that the input AVK expects is setup.

    Code (CSharp):
    1. using UnityEngine;
    2. using System.Collections;
    3.  
    4. using hebertsystems.AVK;
    5.  
    6. [RequireComponent(typeof(RCCCarControllerV2))]
    7. public class RCCVehicle : SteerableVehicle {
    8.  
    9.     public float orbitCameraPivotHeight = 2.5f;                    // The orbit camera pivot height above the position of the vehicle.
    10.     public float maxTurnSpeed = 180f;                            // The maximum turn speed (angles per sec) of the steering system.
    11.     public float maxTurnSpeedAtMax = 45f;                        // The maximum turn speed at vehicle max speed.
    12.  
    13.     public float currentMaxTurnSpeed {
    14.         get {
    15.             float t = Mathf.InverseLerp(0, rccCarControllerV2.maxspeed, mRigidbody.velocity.magnitude);
    16.             return Mathf.Lerp(maxTurnSpeed, maxTurnSpeedAtMax, t);
    17.         }
    18.     }
    19.  
    20.     public override Vector3 orbitCameraPivotBase                 // The pivot base for orbiting cameras.
    21.     {
    22.         get {
    23.             return transform.position;
    24.         }
    25.     }
    26.  
    27.     public override Vector3 orbitCameraPivotOffset                 // The offset from the pivot base for orbit camera pivot point.
    28.     {
    29.         get {
    30.             return Vector3.up * orbitCameraPivotHeight;
    31.         }
    32.     }
    33.  
    34.     public override Vector3 forward { get { return transform.forward; } }        // The forward direction of the vehicle.
    35.     public override Vector3 up { get { return transform.up; } }                // The up direction of the vehicle
    36.     public override Vector3 right { get { return transform.right; } }            // The right direction of the vehicle
    37.     public override Vector3 position { get { return transform.position; } }        // The postion of the vehicle.
    38.     public override Quaternion rotation { get { return transform.rotation; } }        // The rotation of the vehicle.
    39.  
    40.     // Process AVK vehicle input
    41.     public override VehicleInput input                                            // Process Vehicle input.
    42.     {
    43.         set {
    44.             if (value.forwardThrottle.HasValue) mThrottle = Mathf.Clamp(value.forwardThrottle.Value, -1, 1);
    45.             if (value.handBrake.HasValue) mHandBrake = value.handBrake.Value;
    46.             if (value.speedBoost.HasValue) mSpeedBoost = value.speedBoost.Value;
    47.  
    48.             if (value.moveDirection.HasValue) SteerDirection(value.moveDirection.Value);
    49.             if (value.relativeMoveDirection.HasValue) SteerDirectionRelative(value.relativeMoveDirection.Value);
    50.         }
    51.     }
    52.  
    53.     public override float steerAngleCurrent { get { return mSteerAngleCurrent; } }    // The current steer angle of the vehicle (read only).
    54.  
    55.     protected override float steerAngleTarget {
    56.         get { return mSteerAngleTarget; }
    57.         set { mSteerAngleTarget = Mathf.Clamp(value, -maxSteerAngle, maxSteerAngle); }
    58.     }
    59.  
    60.     protected float mSteerAngleCurrent = 0;
    61.     protected float maxSteerAngle = 45;
    62.     protected bool mHandBrake = false;
    63.     protected bool mSpeedBoost = false;
    64.  
    65.     // Reference RCC car controller
    66.     protected RCCCarControllerV2 rccCarControllerV2;
    67.  
    68.     protected override void Awake() {
    69.         base.Awake();
    70.  
    71.         // Obtain reference to RCC car controller and setup.
    72.         rccCarControllerV2 = GetComponent<RCCCarControllerV2>();
    73.         maxSteerAngle = rccCarControllerV2.steerAngle;
    74.         rccCarControllerV2.canControl = true;
    75.         rccCarControllerV2.canEngineStall = false;
    76.         rccCarControllerV2.autoReverse = true;
    77.         rccCarControllerV2.automaticGear = true;
    78.     }
    79.  
    80.     void Start() {
    81.         // Set AIController after Awake
    82.         rccCarControllerV2.AIController = true;
    83.     }
    84.  
    85.     void Update() {
    86.         DriveVehicle();
    87.     }
    88.  
    89.     protected virtual void DriveVehicle() {
    90.         // Move current steer angle towards target at maxTurnAnglePerSec
    91.         mSteerAngleCurrent = Mathf.MoveTowards(mSteerAngleCurrent, mSteerAngleTarget, currentMaxTurnSpeed * Time.deltaTime);
    92.  
    93.         float speedForward = Vector3.Dot(mRigidbody.velocity, transform.forward);
    94.  
    95.         // Send input on to RCC car controller
    96.         rccCarControllerV2.steerInput = mSteerAngleCurrent / maxSteerAngle;
    97.         rccCarControllerV2.gasInput = mThrottle >= 0 ? mThrottle : 0;
    98.         rccCarControllerV2.brakeInput = mThrottle < 0 ? -mThrottle : 0;
    99.         rccCarControllerV2.reverseGear = mThrottle < 0 && speedForward < .1f ? true : false;
    100.         rccCarControllerV2.handbrakeInput = mHandBrake ? 1 : 0;
    101.         rccCarControllerV2.boostInput = mSpeedBoost ? 2.5f : 1;
    102.     }
    103. }
    104.  
     
    Last edited: Feb 3, 2016
    SpaceRay and sahin09 like this.
  40. sahin09

    sahin09

    Joined:
    Oct 29, 2015
    Posts:
    14
    Perfect, thanks very much. Just a small problem, Line 96 "rccCarControllerV2.reverseGear= mThrottle <0&& speedForward < .1f ?true:false;" reverseGear does not exist in the RCCCarControllerV2 script. I just commented it out which may be why I am getting red errors in console even though it compiles and plays, there is serious fps drop and lagging occurring. The error is: "Error adding system: Data not available.", I have uploaded an image below.

    Also when I shoot, the left click shoots both the bullets and rockets and the right click wont do anything, I am sure this is to do with the Input asset? I am not sure

    Also, I don't know if you know what Tobii EyeX Eye Tracking is, but I am planning to use the sdk and swap out instead of the mouse movement, the turret/gun (Reticle) aim will be controlled by users eyes. I hope to get this working and show the progress here. I am new to Unity and C# scripting. Can you recommend, what I need to change in certain script files (I have a basic idea) just to change the mouse movement?

    Thanks again :)

    EDIT: Just to add, the "Error adding system: Data not available." pops up while running the game.

    EDIT 2: With further testing, the shooting for left click and right click seems like its bugged for my vehicles, so left click does both bullets and rockets and right click does nothing. It works perfectly fine with your prefabs on my scene though.
     

    Attached Files:

    • 2121.PNG
      2121.PNG
      File size:
      16.8 KB
      Views:
      739
    Last edited: Feb 2, 2016
  41. whebert

    whebert

    Joined:
    Mar 9, 2013
    Posts:
    72
    That's odd, the version of rccCarControllerV2 that I have has a reverseGear public member, on line 119. I have the Realistic Car Controller version 2.9. Perhaps we have different versions? What do you see on line 119?

    Commenting it out as you did would not cause any errors, and certainly not the error message you are seeing. That message appears to be linked with Global Illumination from a quick Google search... I haven't seen that error myself. Perhaps try to disable GI if not already or tinker with the settings, not sure. Also, perhaps try different versions of Unity - the method I described above was tested with Unity 5.3.0f4 without issue.

    I do not know of Tobii EyeX Eye Tracking, but that sounds like a pretty cool way to aim! Let me know how that goes. I would think you could take the ManualAimingScreenCursor.cs and fairly easily modify it to do what you need, assuming you can get something like normalized or exact screen coordinates from the Tobii SDK? If they do not specify that specifically, I would imagine there is a way to basically obtain or approximate screen coordinates with whatever they do provide.

    I would just take the ManualAimingScreenCursor and rename it to EyeTrackingScreenCursor (both the file and the class), or whatever, and start from there. All you would need is the screen point the user is looking at (however the Tobii SDK ultimately gives you something like that) and cast a ray from that point into the scene using Ray ray = driverCamera.ScreenPointToRay(pointOnScreen) - see inside the UpdateAiming method for an example. When done, you just need to put your new aiming controller in the AVK system alongside the other aiming controllers and it will be used. You could deactivate the other aiming controller objects if you just want yours to operate.

    With the turret firing, the standalone GunRocketTurret prefab somehow got one of its settings messed up. It is correct on the vehicle prefab, but the standalone has one of the weapon settings off. Easy to fix, though. Just go through the GunRocketTurret object hierarchy until you see the Primary Weapon and Secondary Weapon objects. On the Secondary Weapon object, make sure the "Type" field is set to "Secondary". That should fix it. Apply changes to save your prefab.
     
    sahin09 likes this.
  42. sahin09

    sahin09

    Joined:
    Oct 29, 2015
    Posts:
    14
    Ah, yes you are correct I seem to have 2.8? I had RCC on another account long time ago when I wanted to experiment Unity for the first time with a good car asset. I cannot seem to access it thus I will need to buy it again on this account as I had 2.8 left over on my hard drive for my previous test project Surprising thing is, I did expect the reverse not to work as I commented it out on the AVK & RCC bridge script. But the RCCVehicle script slowed down my vehicles and added weight onto it to feel slower then it was? and I was not able to turn on the headlights and stuff which I applied using RCC.

    • So just to experiment, I disabled the RCCVehicle script (AVK & RCC Bridge), although still attached to the vehicle. I started the scene again, and it ran perfectly with the aim and turrets working ect with the exact physics from RCC along with the headlights working. But, most of the time it would bug out and not move at all even though the engine was running. So it seemed like, 2/10 chances you run the scene without the RCCVehicle script enabled, you would be able to control the car with the turrets as normal, but 8/10 times it would be the opposite without being able to move it at all.
    • I fixed the turret firing, as you said, it was the secondary weapon set as primary, just changed it to secondary and that did the job.
    • I am currently on Unity 5.3.1p3, I don't know if that would make a difference, with the "Error adding system: Data not available.", I am still trying to see what is causing the problem in the GI.
    • The PlayerRespawner in which I copied over from the AVK example scene and changed the needed prefabs, it would bug out and not re spawn the 'clone' prefab? after the countdown, so I am forced to click 'o' and restart the scene. And I even tested with multiple prefabs and even your prefabs, made sure they were in the PlayerPrefabs Prefab in the scene and to be sure with the RCCVehicle Script attached and disabled, didn't make a difference.
    • I am yet to test the Tobii EyeX, I am in the progress of trying to implementing it now. I will update any changes
    Thanks :)
     
  43. whebert

    whebert

    Joined:
    Mar 9, 2013
    Posts:
    72
    The reason the vehicle still responded to your input after deactivating RCCVehicle is likely due to the custom Editor script, RCCEditor, which can make changes to vehicle settings during runtime if the vehicle object is selected in the Editor scene hierarchy. The RCCEditor script can continually set the AIController flag to false during runtime, thus setting the vehicle to use the built-in keyboard controls instead of being externally controlled. So your vehicle would get mixed signals, likely, and might explain the odd behavior.

    I've also modified the RCCVehicle script (above) to set the AIController flag later since it could possibly be overwritten by RCCCarControllerV2 in Awake(). However, if you have the vehicle selected for view in the Inspector, the above mentioned RCCEditor will override the flag - so to avoid that, don't have the vehicle selected when playing, even at startup.

    You could actually use the built-in keyboard controls for vehicle input instead of those provided in RCCVehicle, but that wouldn't allow the AVK AI script to also control the vehicle. And you'd have to use the manual A-D (left - right) keys to steer with instead of the camera steering. Depends on what your game requires I guess.

    If you would like to control the lights too through AVK, the proper way would be to add a "public bool? lights;" flag to the VehicleInput script and then set that in PlayerDriver, toggling the value when L is pressed. However, as a hack just to see it work, you could add this inside the RCCVehicle in Update:

    Code (CSharp):
    1. if (GetComponent<PlayerEntity>() && Input.GetKeyDown(KeyCode.L)) {
    2.             rccCarControllerV2.headLightsOn = !rccCarControllerV2.headLightsOn;
    3.         }
    Not sure what might be going on with the player respawner. Tested it in my scene and works fine. Maybe make sure the prefabs in the PlayerPrefabs object are the prefabs saved to disk, from the Project window - not from the scene Hierarchy window.
     
    sahin09 likes this.
  44. sahin09

    sahin09

    Joined:
    Oct 29, 2015
    Posts:
    14
    Big news! I got it to work with the eye tracking, It was much much simple than I thought it would be :D
    Changed "Ray ray = driverCamera.ScreenPointToRay(targetPos);" to "Ray ray = driverCamera.ScreenPointToRay(gazePointInScreenSpace);"

    the SDK had "gazePointInScreenSpace" and its amazingly responsive!!
     
  45. sahin09

    sahin09

    Joined:
    Oct 29, 2015
    Posts:
    14
    I would like to steer manually, "A-D (left - right) keys to steer with instead of the camera steering". I use my Ps4 Controller hooked up via bluetooth, and I use the motion sensor to emulate the steering left and right while using the triggers to accelerate and break/reverse, and the Eye tracking to aim at other vehicles! Its cracking so far, can't wait to fix the bugs and add to it :D.

    And the reason why I need the RCC to control the movement of the car (physics) is because the cars that I already have are set accordingly with attributes to their real life stats I done research on and many tests.

    Thanks to your amazing AVK, I have achieved wonders, the potential never ends! :)

    We posted at the same time lol! I will have a look at that tomorrow, I have to get up early to progress on this :)

    EDIT: Ok just need to do it so the reticle follows the eye movement.

    EDIT2: Fixed :D
     
    Last edited: Feb 3, 2016
  46. whebert

    whebert

    Joined:
    Mar 9, 2013
    Posts:
    72
    Cool! Glad you got that working! Feel free to post a video, sounds fun. :)
     
  47. sahin09

    sahin09

    Joined:
    Oct 29, 2015
    Posts:
    14
    I will soon as I get supplied with a new gaming laptop by my department (University), as the current one I have can barely handle anything and its dying out on me. We have a specializing department that does excessive research on how Eye Tracking works with technology, and where it can be used to make something fun, more helpful and improvements.

    As you may know, their is barely any threads on Tobii Eye X and Unity at all, even on Tobii official forums there is lack of movement, as it is very new to the market. I am hoping there will be more developers like me that can unleash the potential. MSI even launched an integrated one which was out in the market supposedly few days back? but looks like its delayed? No idea (http://www.theverge.com/2016/1/6/10710110/msi-tobii-gaming-laptop-eye-tracking-gt72s-ces-2016)

    Here is a video of a game in action with it:

    (Assassins Creed Syndicate)
     
    whebert likes this.
  48. sahin09

    sahin09

    Joined:
    Oct 29, 2015
    Posts:
    14
    Hey! I have been busy with other work which is why I could not post any updates on my project which I have not touched since!

    Just a quick question though, I am thinking of doing a scoreboard of some sort shown on the GUI. With the XP earned in general, is there a way to convert the xp from the player and also the AI's and store them into a table which will hold the scoreboard and once the highest score on the scoreboard is reached (Amount of take outs of opponents or bullets thrown in general) then the race/game ends?

    Thanks :)

    I also plan to post videos and screenshots soon of my game, I have got a better laptop!
     
  49. whebert

    whebert

    Joined:
    Mar 9, 2013
    Posts:
    72
    Sure, you could gather references to all the Entities in the scene (including the player) and handle that information however you would need.

    I'd suggest modifying the Events class to include events for when an Entity is created and destroyed that your billboard could subscribe to. Something like:
    Code (CSharp):
    1.        public static Action<Entity> entityCreated;
    2.         public static Action<Entity> entityDestroyed;
    3.  
    4.         public static void EntityCreated(Entity entity) {
    5.             if (entityCreated != null) entityCreated(entity);
    6.         }
    7.  
    8.         public static void EntityDestroyed(Entity entity) {
    9.             if (entityDestroyed != null) entityDestroyed(entity);
    10.         }
    Then, in the Entity class, send out the created and destroyed events:
    Code (CSharp):
    1. protected virtual void Awake ()  {
    2.             // ...
    3.             Events.EntityCreated(this);
    4.         }
    5.  
    6. protected virtual void OnDestroy()  {
    7.             // ...
    8.             Events.EntityDestroyed(this);
    9.         }
    Finally, subscribe to the events in your Billboard class, or wherever, and store/remove the Entities in a List<> as they come and go and you'll have an easy updated list of all Entities that you can access the .experience of and do whatever you'd need to.
    Code (CSharp):
    1.        void OnEnable() {
    2.             Events.entityCreated += HandleEntityCreated;
    3.             Events.entityDestroyed += HandleEntityDestroyed;
    4.         }
    5.  
    6.         void OnDisable() {
    7.             Events.entityCreated -= HandleEntityCreated;
    8.             Events.entityDestroyed -= HandleEntityDestroyed;
    9.         }
    10.  
    11.          void HandleEntityCreated(Entity entity) {
    12.             myList.Add(entity);
    13.         }
    14.  
    15.         void HandleEntityDestroyed(Entity entity) {
    16.             myList.Remove(entity);
    17.         }
    18.  
     
    Last edited: Feb 10, 2016
    sahin09 likes this.
  50. sahin09

    sahin09

    Joined:
    Oct 29, 2015
    Posts:
    14
    Thanks for that! Now, I am trying to set up the AI waypoints with the respawn. Just for test, I set up a few waypoints, it follows them correctly and shoots at opponent as well, but when I launch the scene, immediately another clone pops up randomly in front and although I destroy the first one, it wont respawn and I am presented with the error below: "MissingReferenceException: The object of type 'RCCVehicle' has been destroyed but you are still trying to access it.".
    I am just trying to set the waypoints so they can follow around the whole track until the laps or race finish ect. And if they taken out, they are supposed to respawn in the last position they were taken out, which unfortunately I am having a lot of problems with even getting it to respawn.

    Thanks :)
     

    Attached Files: