How can i make the space ship fly in the sky on it's own without controlling it ?

I’m using unity 3d version 5.3.5f1 personal 64 bit.

What i want to do is that the space ship will directly move up on the Y axis i think and then start to fly around the sky by it self, not in space but in the sky so i can see the space ship from the terrain from ground but in the sky i mean in logic sky height

In the hierarchy in the scene i have a space ship object i added it to it 3 things:

  1. RigidBody

  2. Mesh Collider

  3. Script in c#

If i’m running the game now with the error i see the space ship make a turn when it’s on ground then it’s falling through the terrain.

The script need the RigidBody but when using it when adding it to the space ship i’m getting this error:

Non-convex MeshCollider with non-kinematic Rigidbody is no longer supported in Unity 5.
If you want to use a non-convex mesh either make the Rigidbody kinematic or remove the Rigidbody component. Scene hierarchy path “ShipUndamaged”, Mesh asset path “Assets/Crash-Landed_Ship/Meshes/Ship_Undamaged.FBX” Mesh name “Ship_MintCondition”

This is the script in c#:

using UnityEngine;
using System.Collections;

public class MakeObjectFly : MonoBehaviour {

    public float FloatStrenght;
    public float RandomRotationStrenght;

    // Use this for initialization
    void Start () {
   
    }
   
    // Update is called once per frame
    void Update () {

        GetComponent<Rigidbody>().AddForce(Vector3.up *FloatStrenght);
        transform.Rotate(RandomRotationStrenght,RandomRotationStrenght,RandomRotationStrenght);
   
    }
}

This is a screenshot of the space ship inspector:

Well the answer is pretty simple. You need to make you mesh colider convex. Remember though that Convex mesh colliders can have a maximum of 255 triangles, so for complex objects you’ll need a custom mesh for the collider.

More info about mesh colliders can be found here:

Ok i turned on the Convex on the mesh collider. Now the error is gone.
Now when i change in the script in the inspector the Float Strenght from exaple to 9 or 10 the space ship is moving up until it’s gone. How do i make it to move up a bit and then start moving around from side to side or in random directions ? Like patrolling in above.

My question to you would be if you really have to simulate the ship floating through physics.
What is the purpose of this ship? It’s not the player since you want it to move on it’s own, so what’s it’s purpose in the game?

The purpose will be to make later array of space ships flying above to make atmosphere feeling like there are many space ships flying aorund. After that i will make tha the main space ship on ground will be the player where the user control it.

Physics calculations is not something you want to waste processing power on if the object is non-essential. if what you are looking for is to create atmosphere, most games simply fake them.

What you have to make clear is how you want the ships to be “flying around” as you so generally put it. How high above the ground, how dense is the population of for-show ships to create atmosphere? will the player ever encounter these make-believe ships for atmosphere?

About the “flying around” i mean for example 20 objects(space ships) that will fly random around the terrain area(terrain borders) and to make area of height they will fly in. For example if its the Y axis then start from 30 to 70 above ground. And later on in the game the player will be able to use one space ship on ground and take control on it and fly between the other space ships. I’m sure it’s not easy buit this is the main concept.

You might want to use this:

http://www.productivity-boost.com/DownloadNonConvexMeshCollider.html