Capital Ships

In this context, a capital ship is one that controls like the ships in Fractured Space or Dreadnought, where the player can freely rotate the camera to look around and aim the turrets, rotate the ship horizontally, and move forward, back, left, and right.

The SCK_CapitalShips scene provides a fully functioning demo of the capital ship if you wish to take a look.

Creating The Vehicle

If you just want to get started, you can use the CapitalShip_Friendly prefab provided in the kit.

To begin creating a new vehicle, create a new empty game object in the scene and call it whatever you wish, e.g. 'Capital Ship'. Add a Vehicle component and a Vehicle Engines 3D component.

Next, drag your capital ship mesh from the Project folder onto the empty game object so that it becomes a child of it, and make sure the local position and rotation are zero.

Setting Up The Player

If you just want to get started:

  1. Drag the Player_InputSystem_SCK prefab into the scene.

  2. Go to your new ship, open the Vehicle component, and set the Vehicle Class to CapitalShip.

OR if you are in the process of creating your own player:

  1. Create the player Game Agent as described in this section if you haven't already.

  2. Add a PlayerInput_InputSystem_CapitalShipControls component somewhere in its hierarchy.

Next, open the Game Agent component on the player and set the 'starting vehicle' to your new ship.

Run The Scene

Now when you run the scene, you use the WASD, Spacebar and Left Control keys to move it around, and rotate sideways with the Q and E keys.

If the controls are very sensitive, it is likely you have not set up the capital ship's Rigidbody with sufficient mass and drag. You can customize these values as well as the settings on the Vehicle Engines 3D script to customize the performance of the capital ship.

Camera Setup

The camera may not be set up yet, if not, check out this section to create a Vehicle Camera, or simply drag the VehicleCamera_SCK prefab into the scene and remove the default camera.

If you haven't already, add a Camera Target component to the capital ship's root transform, and drag the capital ship into the Starting Target Vehicle field in the inspector of the Vehicle Camera component on the camera.

Once you've done that, you'll need to set up the ship's view gimbal (joint) that allows you to rotate the camera in all directions (ignore this section if you're using the capital ship prefab provided in the kit).

To do this, add a Targeting Gimbal component to the root transform of your capital ship.

Next, do the following steps:

  1. Add a new game object as a child of the capital ship and call it 'Targeting Gimbal'.

  2. Add a new game object as a child of the targeting gimbal, and call it 'Horizontal Pivot'.

  3. Add a new game object as a child of the horizontal pivot, and call it 'Vertical Pivot'.

  4. Add a new game object as a child of the vertical pivot, and call it 'Camera View Target'. Add a Camera View Target component to it, open the inspector, and set Parent Camera On Selected to True.

Now go to the inspector of the Targeting Gimbal component you added earlier.

  1. Drag the Horizontal Pivot object you created above into the Horizontal Pivot field.

  2. Drag the Vertical Pivot object you created above into the Vertical Pivot field.

  3. Drag the Targeting Gimbal object you created above into the Targeting Gimbal Object field.

Now when you run the scene again, you will be able to control the camera rotation to look around as you fly the ship.

You may need to adjust the position of the Horizontal pivot above the ship, and pull the Camera View Target object back, to improve the position of the camera during gameplay.

Last updated