Search Unity

  1. Unity 2020.1 has been released.
    Dismiss Notice
  2. Good news ✨ We have more Unite Now videos available for you to watch on-demand! Come check them out and ask our experts any questions!
    Dismiss Notice

Assets [RELEASED] Sci-Fi Ship Controller - A versatile physics-based controller with playable demos, AI...

Discussion in 'Works In Progress' started by sstrong, Dec 7, 2018.

  1. cassius


    Aug 5, 2012
    Hey guys. How do I go about changing the values for "Max Pitch", "Pitch Speed", and "Turn Roll" via the API at runtime?

  2. sstrong


    Oct 16, 2013
    Code (CSharp):
    1. public ShipControlModule playerShip;
    2. ..
    3. if (playerShip != null && playerShip.IsInitialised)
    4. {
    5.   Ship ship = playerShip.shipInstance;
    6.   ship.maxPitch = myvalue;
    7.   ship.pitchSpeed =
    8.   ship.maxTurnRoll =
    9.   ship.turnRollSpeed =
    10. }
    cassius likes this.
  3. sstrong


    Oct 16, 2013
    Sci-Fi Ship Controller - Docking Basics Tutorial

    docsavage and julianr like this.
  4. sstrong


    Oct 16, 2013
    We have seen some odd errors with not being able to move or delete items in lists in our editors. It is related to some changes Unity has made in the editor. If you run into this problem, we have a patch.

    For people on the beta program, you need SSC v1.1.8 Beta 1d or newer which can be applied to the latest store version (1.1.7).
    Last edited: Jul 10, 2020
  5. sstrong


    Oct 16, 2013
    Mouse deadzone


    Coming in Sci-Fi Ship Controller 1.1.8 is the ability to control mouse deadzone. This will be supported with the following Input Modes:
    • (New) Unity Input System
    • Legacy Unity Input System
    • Keyboard
    This can be useful when you want to control pitch and/or yaw with the mouse. For beta program members, you need version 1.1.7 from the asset store and then 1.1.8 Beta 2d or newer.
    Last edited: Jul 12, 2020
    docsavage and julianr like this.
  6. sstrong


    Oct 16, 2013
    Extensive API

    We continue to build out our extensive API for all aspects of Sci-Fi Ship Controller so that you can:
    • Integrate SSC with your gameplay code
    • Write fewer lines of code yourself
    • Achieve more with less
    • Take advantage of our performance optimisations
    If you are having trouble achieving something within your game with our APIs, please ask or make suggestions.
    julianr likes this.
  7. sstrong


    Oct 16, 2013
    Turret and Auto-Targeting Updates

    Coming in Sci-Fi Ship Controller 1.1.8 are new and improve features for Turrets and Auto-Targeting.


    • Update Target Periodically - Whether the target should be reassigned periodically (after a fixed period of time).
    • Update Target Time - The time to wait (in seconds) before assigning a new target.
    • Can Lose Target - Whether the current target can be 'lost' through either loss of line of sight or an inability to lock on to the target.
    • Target Lost Time - How long (in seconds) a target must be invalid for it to be lost (prompting a new target to be assigned).
    • Require LoS - Whether a target can be 'lost' if line-of-sight is lost.
    • Require Target Lock - Whether a target can be 'lost' if the turret is unable to lock on to it.
    • Turret inaccuracy option is more realistic
    • Turrets adjust for velocity more accurately
    • Auto targeting for ship turrets discard targets outside of firing cone
    docsavage and julianr like this.
  8. sstrong


    Oct 16, 2013
    HUD Updates coming in 1.1.8

    Coming in 1.1.8 are some significant updates for the Ship Display Module. These include:
    • The ability to see changes in the Game view at runtime AND outside play mode
    • A messaging system to display info to the player
    • Scrollable text in display messages
    • Multiple target tracking
    And like almost everything in Sci-Fi Ship Controller, it can be driven by our extensive APIs in your own game code.
    johaswe, docsavage and julianr like this.
  9. campusgame


    Jun 13, 2017
    Hi! Does it work with mobile (android, ios) ?
  10. sstrong


    Oct 16, 2013
    We have tested on Android (both phone and tablets). Like all touch screen or accelerometer controlled devices it will come down to your implementation of user input. If you already have a input method setup, you can send player ship input data directly to our API. There is also a Player Input Module included which has a basic on-screen setup.

    Our scripts are highly optimised and have low performance overhead, so should work fine on most devices. The placeholder demo assets that come with the package are designed for PC and console but you can easily use you own models and assets with SSC.
    campusgame likes this.
  11. sstrong


    Oct 16, 2013
    Ship Display Module - messages

    Scrollable HUD messages are now available for testing. You'll need the current asset store build (Sci-Fi Ship Controller 1.1.7) and the 1.1.8 Beta 4a patch or newer.


    For adding or modifying messages at runtime, see the relevant section of the Runtime and API chapter in the manual (click the Help button to view the manual).
    julianr likes this.
  12. campusgame


    Jun 13, 2017
    Thank you so much! it is great if you have a mobile demo scene for the control and the input.
    I like this plugin, this is awesome!
  13. sstrong


    Oct 16, 2013
    Here is a really quick example of how you could create your own input system to send data to a ship.
    Code (CSharp):
    1. using UnityEngine;
    3. // Sci-Fi Ship Controller. Copyright (c) 2018-2020 SCSM Pty Ltd. All rights reserved.
    4. namespace SciFiShipController
    5. {
    6.     /// <summary>
    7.     /// Attach a SampleSendShipInput component to a player ship that does
    8.     /// NOT use the PlayerInputModule. This is an over-simplified way of sending
    9.     /// input to a player ship without using the PlayerInputModule.
    10.     /// This is only sample to demonstrate how API calls could be used in
    11.     /// your own code. You should write your own version of this in your own
    12.     /// namespace.
    13.     /// For PC and Console typically you will use the PlayerInputModule
    14.     /// with one of the Input Modes.
    15.     /// e.g. Keyboard, Legacy or New Unity Input System, Rewired, Occulus, Vive VR etc
    16.     public class SampleSendShipInput : MonoBehaviour
    17.     {
    18.         #region Private Variables
    19.         private ShipControlModule shipControlModule = null;
    20.         private ShipInput shipInput = null;
    21.         private bool isInitialised = false;
    22.         #endregion
    24.         #region Initialisation Methods
    26.         // Start is called before the first frame update
    27.         void Start()
    28.         {
    29.             shipControlModule = GetComponent<ShipControlModule>();
    31.             if (shipControlModule != null)
    32.             {
    33.                 // If Initialise On Awake is not ticking on the ship, initialise the ship now.
    34.                 if (!shipControlModule.IsInitialised) { shipControlModule.InitialiseShip(); }
    36.                 if (shipControlModule.IsInitialised)
    37.                 {
    38.                     // Create a new instance of the shipInput which we can send each frame to the ship.
    39.                     shipInput = new ShipInput();
    41.                     isInitialised = shipInput != null;
    42.                 }
    43.             }
    44.             #if UNITY_EDITOR
    45.             else
    46.             {
    47.                 Debug.LogWarning("[ERROR] SampleSendShipInput.Start() could not find the ship! Did you attach this script to a ShipControlModule?");
    48.             }
    49.             #endif
    51.             // Our sample uses the legacy input system to get keyboard input.
    52.             // However, you can use any input system you like e.g. Touch screen input from a mobile or a controller etc.
    53.             #if !ENABLE_LEGACY_INPUT_MANAGER && UNITY_2019_2_OR_NEWER
    54.             Debug.LogWarning("ERROR: SampleSendShipInput - This sample uses keyboard input from Legacy Input System which is NOT enabled in this project.");
    55.             #endif
    56.         }
    58.         #endregion
    60.         #region Update Methods
    61.         // Update is called once per frame
    62.         void Update()
    63.         {
    64.             if (isInitialised && shipControlModule.ShipIsEnabled())
    65.             {
    66.                 // This sample uses simple keyboard input from the legacy Unity Input System.
    67.                 // Here is where you'd get your input from your target devices.
    68.                 // For example touch screen on a mobile or accelerometer etc.
    70.                 // Reset input axes
    71.                 shipInput.horizontal = 0f;
    72.                 shipInput.vertical = 0f;
    73.                 shipInput.longitudinal = 0f;
    74.                 shipInput.pitch = 0f;
    75.                 shipInput.yaw = 0f;
    76.                 shipInput.roll = 0f;
    77.                 shipInput.dock = false;
    79.                 #if ENABLE_LEGACY_INPUT_MANAGER || !UNITY_2019_2_OR_NEWER            
    80.                 // You may wish to lerp towards a value over several frames or modify
    81.                 // you ship's pitch/yaw/roll/turn acceleration on the Physics tab.
    83.                 // Forward and Back
    84.                 if (Input.GetKey(KeyCode.UpArrow)) { shipInput.longitudinal += 1f; }
    85.                 if (Input.GetKey(KeyCode.DownArrow)) { shipInput.longitudinal -= 1f; }
    87.                 // Pitch up and down
    88.                 if (Input.GetKey(KeyCode.W)) { shipInput.pitch += 1f; }
    89.                 if (Input.GetKey(KeyCode.S)) { shipInput.pitch -= 1f; }
    91.                 // Left and Right
    92.                 if (Input.GetKey(KeyCode.RightArrow)) { shipInput.yaw += 1f; }
    93.                 if (Input.GetKey(KeyCode.LeftArrow)) { shipInput.yaw -= 1f; }
    95.                 // Roll left and right
    96.                 if (Input.GetKey(KeyCode.D)) { shipInput.roll += 1f; }
    97.                 if (Input.GetKey(KeyCode.A)) { shipInput.roll -= 1f; }
    99.                 // Keep firing when the space bar is held down
    100.                 shipInput.primaryFire = Input.GetKey(KeyCode.Space);
    101.                 #endif
    103.                 shipControlModule.SendInput(shipInput);
    104.             }
    105.         }
    106.         #endregion
    107.     }
    108. }
    On PC and console you'd typically just use our PlayerInputModule. However, on Android and IOS you'd probably want to create your own on-screen buttons and input methods using the above sample as a guide.
    julianr likes this.
  14. sstrong


    Oct 16, 2013
    Ship Display Module - on-screen target tracking

    As promised, in Sci-Fi Ship Controller 1.1.8 there will be on-screen target tracking. This feature allows you to link radar data about enemy ships or gameobjects with on-screen Display Targets, AND guided projectile weapons.


    Starting in 1.1.8 Beta 4p there is a sample script (SampleHUDTargets.cs) that show how to build a customised solution via our APIs. And yes, it is fully commented so that you can follow how it works.

    We are now working on integrating this solution into the AutoTargetingModule for rapid deployment and very quick setup for people who want to configure everything from the editor.
    julianr likes this.
  15. sstrong


    Oct 16, 2013
    Here are just some of the new features and improvements coming in Sci-Fi Ship Controller 1.1.8.

    [NEW] PlayerInputModule - Mouse deadzone
    [NEW] ShipDisplayModule - IsSourceShip, CentreCursor API methods
    [NEW] ShipDisplayModule - scrollable messages with API
    [NEW] ShipDisplayModule - on-screen targets with API
    [NEW] ProjectileModule - editor runtime debugging option
    [NEW] HUD - SampleHUDTargets script for on-screen target tracking
    [NEW] Radar API methods to check if blips are in viewable screen viewports
    [NEW] AutoTargetingModule - optional on-screen target tracking
    [NEW] AutoTargetingModule - support for fixed weapons with guided projectiles
    [FIXED] ShipDisplayModule - HUD does not adjust for screen resizing
    [FIXED] Editors - cannot delete or move list items in U2019.3+
    [FIXED] Radar - GetRadarResults API method ignored query sort order and created GC
    [FIXED] Weapons - turning off Multiple Fire Positions may result in incorrect fire position
    [IMPROVED] Ship AI Input Module - runtime editor debugging
    [IMPROVED] Ship Docking is out of technical preview
    [IMPROVED] PlayerInputModule – (new) Unity Input System out of technical preview
    [IMPROVED] PlayerInputModule - detect when legacy Unity Input System is disabled in 2019.2+
    [IMPROVED] Turrets inaccuracy option is more realistic
    [IMPROVED] Turrets adjust for velocity more accurately
    [IMPROVED] Auto targeting for ship turrets discard targets outside of firing cone

    They are currently in beta testing. Any SSC customer can get access to the Beta Program if they want to test new features coming in the next release. It is great way to help improve the product and influence the design by providing direct feedback to the developers.
    julianr likes this.