Search Unity

  1. Unity 2018.3 is now released.
    Dismiss Notice
  2. The Unity Pro & Visual Studio Professional Bundle gives you the tools you need to develop faster & collaborate more efficiently. Learn more.
    Dismiss Notice
  3. We've updated our Terms of Service. Please read our blog post from Unity CTO and Co-Founder Joachim Ante here
    Dismiss Notice
  4. Want to provide direct feedback to the Unity team? Join the Unity Advisory Panel.
    Dismiss Notice
  5. Improve your Unity skills with a certified instructor in a private, interactive classroom. Watch the overview now.
    Dismiss Notice

Space Combat Kit (VSXGames) [RELEASED]

Discussion in 'Works In Progress' started by Billy4184, Jul 14, 2015.

  1. frankadimcosta

    frankadimcosta

    Joined:
    Jan 14, 2015
    Posts:
    92
    In file DemoTargetTrackingWidget.CS

    Line 443,444, 446,447
    add
    && widgetParameters.isSelectedTarget
    to
    widgetParameters.showBarField && widgetParameters.isOnScreen
     
  2. frankadimcosta

    frankadimcosta

    Joined:
    Jan 14, 2015
    Posts:
    92
    Why you don't share the solution ?
     
  3. frankadimcosta

    frankadimcosta

    Joined:
    Jan 14, 2015
    Posts:
    92
    1) For your game: you need a radar system. SCK is a good choice. Other modules (energy, shield, mount system, gamestate) are a plus (a HUGE plus).
    2) On the asset store you can find free helicopter controllers.
    Long time ago i found these free projects:
    https://www.assetstore.unity3d.com/en/?stay#!/content/40107
    https://www.assetstore.unity3d.com/en/?stay#!/content/27229
     
    Last edited: Dec 31, 2018
  4. ForceVFX

    ForceVFX

    Joined:
    Jan 21, 2011
    Posts:
    517
    Billy4184 and frankadimcosta like this.
  5. Billy4184

    Billy4184

    Joined:
    Jul 7, 2014
    Posts:
    4,028
    Hi everyone, sorry I haven't been very available here over the last couple of days, sailing a boat takes a bit of concentration!

    Thanks for all the feedback regarding having more small step-by-step 'how-to' sections about how to do specific things in the kit. Would this be perhaps better done with videos?

    Very soon. The capital ship behaves like in the Dreadnought game. The camera is on a swivel and the turrets follow where the camera is pointing. The ship is slower, and it doesn't pitch (rotate up and down) or roll (rotate left and right) instead the ship rotates on the y-axis and moves up/down and left/right.
     
    navy3001 and JFI66 like this.
  6. Billy4184

    Billy4184

    Joined:
    Jul 7, 2014
    Posts:
    4,028
    Glad you got this sorted, but it would ideally be done in the HUDTargetTracking script, so that you can adjust the settings in only one place. I have added checkboxes for selected/unselected targets in this script.

    Untitled.png
     
    JFI66 and frankadimcosta like this.
  7. navy3001

    navy3001

    Joined:
    Jun 1, 2017
    Posts:
    7
    Nice! will there be a bridge view as well? because for a game I plain on making..i would like bridge view and cokpit views
     
  8. frankadimcosta

    frankadimcosta

    Joined:
    Jan 14, 2015
    Posts:
    92
    GREAT !!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!
     
  9. frankadimcosta

    frankadimcosta

    Joined:
    Jan 14, 2015
    Posts:
    92
    A little problem: my game uses a pooling system with namespace PoolManager, namespace that collides with SCK pooling system. It's possibile to change his namespace to SCKPoolManager ? So i can use both fo them. Thanx.
     
  10. frankadimcosta

    frankadimcosta

    Joined:
    Jan 14, 2015
    Posts:
    92
    Another request. It's possibile to add an handler for Xbox controller ?

    public enum InputType
    {
    Mouse,
    Keyboard ,
    Xbox
    }

    SCK has a rumble module !!!
     
  11. frankadimcosta

    frankadimcosta

    Joined:
    Jan 14, 2015
    Posts:
    92
    Another litthe problem: GameStateManager.CS at line 127 Time.timeScale = 1;
    But i need a lower TimeScale. I modified the script to save current TimeScale in Awake() and restore this value when not in pause.
     
  12. ForceVFX

    ForceVFX

    Joined:
    Jan 21, 2011
    Posts:
    517
    A little inspiration?...to start the new year.



    p-
     
    frankadimcosta likes this.
  13. navy3001

    navy3001

    Joined:
    Jun 1, 2017
    Posts:
    7
    are there playable capital ships? if not, then I do not need to worry, my game will still be good (when I decide to make it that is)
     
  14. frankadimcosta

    frankadimcosta

    Joined:
    Jan 14, 2015
    Posts:
    92
    HAPPY NEW YEAR !!!

     
    Billy4184 likes this.
  15. ForceVFX

    ForceVFX

    Joined:
    Jan 21, 2011
    Posts:
    517
    Nope, strictly down & dirty solo dogfights, just the way I like 'em!

    Actually posted because, I'm pretty sure it's unity (unreal has much better human skin shaders, out of the box) and all the game play seems possible with SCK, all ya need is some high quality PBR animated ships..

    hmmmm where to find 'em?......now to search google...and done..4 ships for under 50 bucks....Sold!...high quality 4k textures, landing gear, animated and after I'm done in Quixel, (like substance) I might achieve, close to that quality..



     
    Last edited: Jan 1, 2019
  16. Billy4184

    Billy4184

    Joined:
    Jul 7, 2014
    Posts:
    4,028
    Happy new year everyone!

    In the demo, there is just an outside view. But if you have a ship model with an interior you can easily add a Camera View Target on the bridge.

    That seems like a good idea.

    With the Rewired integration, any joystick (which is what Rewired calls gaming peripherals including gamepads) that is connected overrides the keyboard and mouse controls.

    I will make this class inheritable so you can extend it and override what it does.

    Looks like it's going to be a cracker of a game!

    Not sure if it's Unity, but from what I read about them I wouldn't be surprised since they are very smart about making the development process as easy as possible, they use the Asset Store a fair bit.
     
    JFI66 likes this.
  17. re-entry

    re-entry

    Joined:
    Aug 6, 2013
    Posts:
    10
    That's great!! Thank you!
    Sorry for not posting the solution! I change the values, as frankadimcosta recommended.
     
    Last edited: Jan 1, 2019
    JFI66 likes this.
  18. frankadimcosta

    frankadimcosta

    Joined:
    Jan 14, 2015
    Posts:
    92
    Another request: cannot build the assest as not a complete project so we can easy import what we need ? tnx.
     
  19. navy3001

    navy3001

    Joined:
    Jun 1, 2017
    Posts:
    7
    dang.. I was hopeing for a bridge view for the captical ship so I could see how a bridge would work for captical ships
     
  20. frankadimcosta

    frankadimcosta

    Joined:
    Jan 14, 2015
    Posts:
    92
    BIG TROUBLES with Unity prefab handling.
    Upgrading from Vehicle Combat Radar to Space Combat Kit, Unity editor added old scripts from prefab with the same name to the new version of SPC. It's impossible to have the 2 assets in the project.
     
  21. re-entry

    re-entry

    Joined:
    Aug 6, 2013
    Posts:
    10
    another question:
    What is the best way to change the team during runtime?
    Ships should attack after being hit.
    thanks.
     
  22. Roachie

    Roachie

    Joined:
    Aug 2, 2009
    Posts:
    61
    I’ve owned this kit since day 1 and it was amazing back then , excited to jump back in soon and check out these new features .

    One thing I wanted to ask though and I’m not sure if it’s already possible here. Is there an easy way to modify the target hologram ui effect to supply more information such as a pilots name or something like that ?

    What’s the best way to add more metadata to an enemy ship ?
     
  23. Billy4184

    Billy4184

    Joined:
    Jul 7, 2014
    Posts:
    4,028
    Sorry can you explain this a bit further, I didn't understand.

    That's right. The SCK essentially includes the Vehicle Combat Radar (that's why there is an upgrade so that SCK customers who already have VCR only pay the difference). There is no need to use VCR if you have SCK.

    The GameAgent controlling a Vehicle has a Team value that you can change to change teams.

    All of the HUD components access target data from the Radar of the ship, which in turn tracks targets with the Trackable class. The Trackable class has a Label property that would essentially relay the Label value of the GameAgent (which is the pilot).

    If you add a Text item to the HUD and create a reference to it in the HUDHologram component, then you can set it using the label of the selected target (Vehicle.Radar.SelectedTarget.Label).

    You might want to check if there's a selected target first with the Vehicle.Radar.HasSelectedTarget property.
     
  24. Roachie

    Roachie

    Joined:
    Aug 2, 2009
    Posts:
    61
    Thanks for the tips will defintely give this a shot
     
  25. frankadimcosta

    frankadimcosta

    Joined:
    Jan 14, 2015
    Posts:
    92
    1) When you import the assets Unity Editor alerts that all project settings will be overwritten. This is a BIG problem.
    1b) The assets contains the unnecessary postprocessing directory that arises 3 errors in a module. It's easy to correct them, but a clean release is better !!!

    Assets/SpaceCombatKit/PostProcessing/Editor/PropertyDrawers/MinDrawer.cs(6,34): error CS0104: `MinAttribute' is an ambiguous reference between `UnityEngine.MinAttribute' and `UnityEngine.PostProcessing.MinAttribute'

    Assets/SpaceCombatKit/PostProcessing/Editor/PropertyDrawers/MinDrawer.cs(11,13): error CS0104: `MinAttribute' is an ambiguous reference between `UnityEngine.MinAttribute' and `UnityEngine.PostProcessing.MinAttribute'

    Assets/SpaceCombatKit/PostProcessing/Editor/PropertyDrawers/MinDrawer.cs(11,39): error CS0104: `MinAttribute' is an ambiguous reference between `UnityEngine.MinAttribute' and `UnityEngine.PostProcessing.MinAttribute'


    2) It's true, but the upgrading is a shame. If you remove the old Vehicle Combat Radar, the editor will loose all references to the scripts of the asset in the scene and all setting parameters. So I must reenter the missing values and scripts. If you have al lot of gameobjects, it's a nightmare.
     
    Last edited: Jan 7, 2019
    JFI66 likes this.
  26. Billy4184

    Billy4184

    Joined:
    Jul 7, 2014
    Posts:
    4,028
    Thanks for the feedback, I'll take a look at this. I would like to keep the post processing in the demo, so that people can have everything they see in the WebGL.

    I'll take a look at this. Most likely I will update the VCR and then simply include it in SCK.
     
    JFI66 and frankadimcosta like this.
  27. frankadimcosta

    frankadimcosta

    Joined:
    Jan 14, 2015
    Posts:
    92
    TNX A LOT ! Great support !!!
     
  28. frankadimcosta

    frankadimcosta

    Joined:
    Jan 14, 2015
    Posts:
    92
    A little gift ! A little fragmenter module:
    Faster without slowmotion, without FX effects (obviusly)

    /// <summary>
    /// DM_ExploderBehaviourScript.cs
    /// Self Contained utility that allows exploting a mesh into multiple triangle pieces.
    /// </summary>
    using UnityEngine;
    using System.Collections;

    public class DM_ExploderBehaviourScript:MonoBehaviour
    {
    /// <summary>
    /// The Exploder force.
    /// </summary>
    public float exploderForce;
    /// <summary>
    /// The Exploder radius.
    /// </summary>
    public float exploderRadius;
    /// <summary>
    /// The Exploder slow motion amount.
    /// </summary>
    public float exploderSlowMotionAmount = 0.2f;
    /// <summary>
    /// The destroy pieces after amount of seconds specified.
    /// </summary>
    public float destroyPiecesAfterSeconds = 5.0f;
    /// <summary>
    /// The mesh piece prefix.
    /// </summary>
    public string meshPiecePrefix = "Piece";
    /// <summary>
    /// The triangle points. Do not change this as you need 3 points for a triangle
    /// </summary>
    private int trianglePoints = 3;

    /// <summary>
    /// The max indices. This number must carefully watched as it could
    /// lead to hight CPU consumption. It determines how many debris to create
    /// during the explotion.
    /// </summary>
    private int maxIndicesTotal = 500;

    /// <summary>
    /// Creates the Exploder piece game object.
    /// </summary>
    /// <returns>The Exploder piece game object.</returns>
    /// <param name="i">The index.</param>
    /// <param name="mesh">Mesh.</param>
    /// <param name="MR">M.</param>
    ///
    ///
    ///


    public Material FragmentMaterial = null;
    public GameObject FireFX=null;
    public float FireFXDuration=0.0f;
    public GameObject SmokeFX=null;
    public float SmokeFXDuration=0.0f;
    public GameObject ExtraFX=null;
    public float ExtraFXDuration=0.0f;

    GameObject CreateExploderPieceGameObject (int i, Mesh mesh, MeshRenderer MR, int submesh)
    {
    GameObject pieceGameObject = new GameObject (meshPiecePrefix + (i / 3));
    pieceGameObject.transform.position = transform.position;
    pieceGameObject.transform.rotation = transform.rotation;
    pieceGameObject.AddComponent<MeshRenderer> ().material = MR.materials [submesh];
    pieceGameObject.AddComponent<MeshFilter> ().mesh = mesh;
    pieceGameObject.AddComponent<BoxCollider> ();
    pieceGameObject.AddComponent<Rigidbody> ().AddExplosionForce (exploderForce, transform.position, exploderRadius);

    if (FireFX!=null)
    {GameObject P = Instantiate(FireFX, transform.position, transform.rotation) as GameObject;
    P.transform.parent=pieceGameObject.transform;
    if (FireFXDuration>0)
    Destroy (P,FireFXDuration);
    }
    if (SmokeFX!=null)
    {GameObject P = Instantiate(SmokeFX, transform.position, transform.rotation) as GameObject;
    P.transform.parent=pieceGameObject.transform;
    if (SmokeFXDuration>0)
    Destroy (P,SmokeFXDuration);
    }
    if (ExtraFX!=null)
    {GameObject P = Instantiate(ExtraFX, transform.position, transform.rotation) as GameObject;
    P.transform.parent=pieceGameObject.transform;
    if (ExtraFXDuration>0)
    Destroy (P,ExtraFXDuration);
    }

    return pieceGameObject;
    }

    /// <summary>
    /// Divides the mesh.
    /// </summary>
    /// <returns>The mesh.</returns>
    public IEnumerator DivideMesh ()
    {
    MeshFilter meshFilter = GetComponent<MeshFilter>();
    MeshRenderer meshRenderer = GetComponent<MeshRenderer>();
    Mesh mesh = meshFilter.mesh;
    Vector3[] vertices = mesh.vertices;
    Vector3[] normals = mesh.normals;
    Vector2[] uvs = mesh.uv;
    for (int submesh = 0; submesh < mesh.subMeshCount; submesh++)
    {
    int[] indices = mesh.GetTriangles(submesh);

    //Add limits to avoid performance issues (delays)
    int maxIndices = indices.Length >= maxIndicesTotal ? maxIndicesTotal : indices.Length;

    for (int i = 0; i < maxIndices; i += trianglePoints)
    {
    Vector3[] newVertices = new Vector3[trianglePoints];
    Vector3[] newNormals = new Vector3[trianglePoints];
    Vector2[] newUvs = new Vector2[trianglePoints];
    for (int n = 0; n < trianglePoints; n++)
    {
    int index = indices[i + n];
    newVertices[n] = vertices[index];
    newUvs[n] = uvs[index];
    newNormals[n] = normals[index];
    }
    Mesh currentMesh = new Mesh();
    currentMesh.vertices = newVertices;
    currentMesh.normals = newNormals;
    currentMesh.uv = newUvs;

    currentMesh.triangles = new int[] { 0, 1, 2, 2, 1, 0 };
    //Calculate Mesh Tangets
    //MeshTangents.calculateMeshTangents(currentMesh);
    currentMesh.RecalculateNormals();

    GameObject temporaryGameObject = CreateExploderPieceGameObject (i, currentMesh, meshRenderer, submesh);
    if (FragmentMaterial!=null)
    temporaryGameObject.GetComponent<MeshRenderer>().material = FragmentMaterial;

    Destroy(temporaryGameObject, destroyPiecesAfterSeconds + Random.Range(0.0f, destroyPiecesAfterSeconds));
    }
    }
    meshRenderer.enabled = false;
    if (exploderSlowMotionAmount!=0.0f)
    {
    float CurrentTimeScale = Time.timeScale;
    Time.timeScale = exploderSlowMotionAmount;
    yield return new WaitForSeconds(0.2f);
    Time.timeScale = CurrentTimeScale;
    }
    //Destroy(gameObject);
    }

    /* void OnTriggerEnter(Collider col){
    if(col.tag == "SpaceshipBullet"){
    StartCoroutine(DivideMesh());
    }

    }*/
    }
     
    Last edited: Jan 10, 2019
    JFI66 likes this.
  29. frankadimcosta

    frankadimcosta

    Joined:
    Jan 14, 2015
    Posts:
    92
    A little request: AI Behaviours are a great tool, but ... I need an ALIEN (UFO) flying behaviour. Now Enemy and Friends flying is identical. It is possibile to change it using parameters ? Can you explain me ? TNX !
     
  30. navy3001

    navy3001

    Joined:
    Jun 1, 2017
    Posts:
    7
    how much longer until the capital ship is ready?
     
  31. joshua_42

    joshua_42

    Joined:
    Jun 23, 2016
    Posts:
    37
    Hello there. I'm trying to get my ship to not accelerate backwards once it's reached zero velocity in the forward axis (stop!). What do you think the best way to achieve this is? Thanks.
     
  32. Billy4184

    Billy4184

    Joined:
    Jul 7, 2014
    Posts:
    4,028
    Hi, sorry about the late reply, I must have missed one notification and then didn't get any more.

    If you look at the various behavior scripts, especially CombatBehavior.cs, they have the implementation of how the AI acts - attacking and evading alternately.

    What sort of different behavior are you looking for? If you give me some details I can tell you how best to implement it.
     
  33. Billy4184

    Billy4184

    Joined:
    Jul 7, 2014
    Posts:
    4,028
    Very soon. All the time I spent on SCK last week was reviewing a lot of very detailed feedback I've gotten about problems with user friendliness, and I've begun to work on removing interfaces and using a mix of composition and extendable base classes to provide a better modular foundation. I started with the radar and HUD as they represent probably the most complex single area of the kit, and I'm very happy about where it's going.

    I know it's not what you wanted to hear, but I felt I had to do something to begin a change because there are a lot of people a bit overwhelmed especially with dealing with interfaces and some of the slightly excessive uses of it in this kit, as well as the lack of prepared base classes for them to build on.

    But I will not be updating anything else before I get the capital ship demo done. I will make a post tomorrow with more details about it.
     
  34. Billy4184

    Billy4184

    Joined:
    Jul 7, 2014
    Posts:
    4,028
    Hi! Go to the SpaceVehicleEngines component on the ship, go to the Min Translation Input Values field and set the Z value to zero.

    The input value is multiplied by the maximum force that can be applied to the ship on each of the axes to determine the force applied at each frame. So if that input value can go negative, the ship will be able to move 'backward' along that axis.

    Let me know if anything does not make sense.
     
    joshua_42 likes this.
  35. frankadimcosta

    frankadimcosta

    Joined:
    Jan 14, 2015
    Posts:
    92
    I need an "UFO" flying style: fast acceleration and fast direction change (no inertia, I suppose). Zig-zag flying for example.
     
    Last edited: Jan 12, 2019 at 11:17 AM
  36. frankadimcosta

    frankadimcosta

    Joined:
    Jan 14, 2015
    Posts:
    92
    Another request (Billy will hate me): I need a NAVIGATION radar. An arrow driving the player to a target gameobject choosed on a map or on a list.
    My ideal RADAR system is a NAVIGATION radar using an arrow on screen border + a COMBAT radar using arrows around the HUD center like the "mode 2" in Vehicle Combat Radar.

    The navigation radar needs other features:
    1) A flag to set (not friend) gameobject trackable or not (not only selectable) so it can be set trackable only after the player found it the first time. (Now I'm using a workaround that unregisters it at start and it registers again after player discovers it)
    2) Waypoints (buildings) must be trackable and selectable at any distance, once discovered.
    (Or from start if friendly buildings, obviously)

    PS: A nice feature for both radar could be the possibility to set the distance for trackability as a parameter for each type (waypoint, ship, etc) or, better, for each gameobject.

    PSS: Sorry for my bad english.
     
    Last edited: Jan 12, 2019 at 11:40 AM
    JFI66 likes this.
  37. Billy4184

    Billy4184

    Joined:
    Jul 7, 2014
    Posts:
    4,028
    First of all you can implement waypoints simply by adding a value to the TrackableType enum (found in ITrackable.cs) and using the DemoTrackable script on a transform in the scene for your waypoint. In fact waypoints have already been implemented as a trackable type.

    On the DemoTrackable component, there is a field called 'Ignore Tracking Distance' which makes the object trackable at any range - perfect for waypoints!

    Great suggestion, I will make the off-screen arrow properties modifiable per trackable type.

    How you implement discoverability is a separate feature that will be unique to your game, but I will put in a toggle on DemoTrackable for whether to register at start or not. Then you can simply register it from any script when you want by calling
    Code (CSharp):
    1. RadarSceneManager.Instance.Register(theTrackable).
    As mentioned, on the DemoTrackable component, there is a field called 'Ignore Tracking Distance' which makes the object trackable at any distance.

    In regards to waypoint selection, well the selected target is really for targeting enemies and is tied to missile locking and lead target calculation. I recommend extending the Radar base class and adding a 'selected waypoint' property, and extending the HUDTargetTracking and/or HUDRadar3D to visualize it.

    These classes are not set up right now as base classes but they should be and they will.
     
    frankadimcosta likes this.
  38. frankadimcosta

    frankadimcosta

    Joined:
    Jan 14, 2015
    Posts:
    92
    WOW !!! TNX a LOT !
     
    Billy4184 likes this.
  39. Billy4184

    Billy4184

    Joined:
    Jul 7, 2014
    Posts:
    4,028
    I can't provide an exact implementation for you but I suggest you modify CombatBehavior to make the ship do what you want it to.

    No inertia might mean you'd rather not use physics (and make the rigidbody kinematic). That will make all lead target calculations not work as they rely on rigidbody velocity. However the DemoTrackable has a reference to an instance of the PhysicsInfo class which is for providing separate physics information not tied to the rigidbody (I added it in there originally for multiplayer non-local ships that are driven by network information and not physics). Using this might mean modifying the lead target calculation code. If you go this route let me know and I will help you sort it out - I really should make it easier to not use physics though.
     
    frankadimcosta likes this.
  40. frankadimcosta

    frankadimcosta

    Joined:
    Jan 14, 2015
    Posts:
    92
    I'll try it and I'll keep you informed !
     
  41. Billy4184

    Billy4184

    Joined:
    Jul 7, 2014
    Posts:
    4,028
    I have been working on the capital ship demo today. I am separating the camera controller functionality from VehicleCamera, so you will be easily able to write camera controllers for different vehicles - this is needed for the capital ship camera controller to work alongside the space fighter camera controller.

    Similar to the way the player input scripts work, the VehicleCamera will load the appropriate camera controller script according to the VehicleControlClass of the focused vehicle.

    At this rate the capital ship update should be sent by Wednesday.
     
  42. csofranz

    csofranz

    Joined:
    Apr 29, 2017
    Posts:
    178
    Hi all,

    here's a (now somewhat extensive) tutorial on how to use many aspects of SCK, how they seem to fit together, and how you can implement common tasks using SCK.

    Please be advised that Billy hasn't reviewed this, so any mistakes are my own. I have no affiliation with Billy other than being a happy customer of SCK.

    I'll expand the tutorial whenever I run into an interesting question :) - apologies for posting a PDF, this site seems to disallow RTF.

    (and I just noticed that the PDF has lost all images. This will be remedied in a future version)
     

    Attached Files:

    mikedolan03, joshua_42, limo and 2 others like this.
  43. frankadimcosta

    frankadimcosta

    Joined:
    Jan 14, 2015
    Posts:
    92
    Great job ! TNX A LOT !!
     
  44. csofranz

    csofranz

    Joined:
    Apr 29, 2017
    Posts:
    178
    Ok, here's a better version of the tut, properly formatted and all. Still PdF, but now with images. I hate MS Word.
     

    Attached Files:

    Last edited: Jan 15, 2019 at 5:42 PM
    Billy4184, limo and frankadimcosta like this.
  45. frankadimcosta

    frankadimcosta

    Joined:
    Jan 14, 2015
    Posts:
    92
    Even better !!!
     
  46. joshua_42

    joshua_42

    Joined:
    Jun 23, 2016
    Posts:
    37
    Hello again. Loving the kit! The obstacle avoidance behaviour supplied is excellent at what it's designed for (avoiding asteroids, ships etc). Is it possible to adjust the inspector parameters to create a terrain avoidance behaviour? I'm using the Space Graphics Toolkit with it's LOD terrain system (not unity terrain, just a mesh). Would I have to create a new specific behaviour (maybe using raycasts to check distance, direction, speed against turn rate?). Thanks.
     
  47. frankadimcosta

    frankadimcosta

    Joined:
    Jan 14, 2015
    Posts:
    92
    I'm removing the old VCR and i need to upgrade missile targeting code.
    in old code i used
    if (MyDemoRadar.CurrentLockState == RadarFunctions.LockState.Locked))
    target = MyDemoRadar.SelectedTarget.GetGameObject().transform;

    SCK Radar is missing CurrentLockState and GetGameObject().
    How can I check if an itrackable gameobject has been locked ?
    TNX
     
  48. csofranz

    csofranz

    Joined:
    Apr 29, 2017
    Posts:
    178
    I don't have access to my dev sys right now, but if you look into sck's combat behavior, there is a section that determines if the ADI can fire a missile. That can only happen if it has a lock, so you have 99% of your answer.

    I'll be less cryptic once I have access to my main, sorry.

    -ch
     
    frankadimcosta likes this.
  49. frankadimcosta

    frankadimcosta

    Joined:
    Jan 14, 2015
    Posts:
    92
    Found ! TNX ! But it's a bad workaround. Why use AI for the player ?

    Locked checking:

    bool foundLock = false;
    for (int i = 0; i < blackboard.Vehicle.Weapons.MountedWeapons.Count; ++i)
    {
    if (blackboard.Vehicle.Weapons.MountedWeapons.IsMissileModule)
    {
    if (blackboard.Vehicle.Weapons.MountedWeapons.MissileModule.LockState == LockState.Locked)
    {
    foundLock = true;
    }
    }
    }

    Current target:
    Vector3 targetPosition = blackboard.Vehicle.Radar.SelectedTarget.CachedTransform.position;
     
  50. frankadimcosta

    frankadimcosta

    Joined:
    Jan 14, 2015
    Posts:
    92
    For the UFO flying model (zig-zag) modifying the CombatBehaviour.cs could be a solution ?

    Can i change the weave model ?


    // Add a weave to the path of the vehicle
    private Vector3 AddWeave(Vector3 pathDirection, float weaveSpeed, float weaveSlope, float anxietyCoefficient)
    {
    float offsetX = (Mathf.PerlinNoise(Time.time * weaveSpeed, Time.time * weaveSpeed) - 0.5f) * 2f;
    float offsetY = (Mathf.PerlinNoise(Time.time * weaveSpeed, Time.time * weaveSpeed) - 0.5f) * 2f;
    Vector3 offsetVec = new Vector3(offsetX, offsetY).normalized * anxietyCoefficient * 2f;
    Vector3 offset = new Vector3(offsetVec.x, offsetVec.y, 1).normalized;
    pathDirection = Quaternion.FromToRotation(Vector3.forward, pathDirection) * offset;

    return pathDirection;
    }
     
    Last edited: Jan 15, 2019 at 10:02 PM