Hey!
Very quick question: I have flying (in space) Character Controller. It has a rigidbody to it but to make it fly, I had to disable:
use gravity and is kinematic.
Without those two turned on - my Character is not seeing any Collision with collider (it would fly through the objects).
With isKinematic - player is not flying but standing in the space
With UseGravity - player is falling.
Here is the way I scripted “moving in space”
public Transform cameraT; //This is for the direction of the force
public float maxSpeed; //maxSpeed for PlayerMovement
public float forceModule = 10; //Just because it says so in the guide
public Vector3 forceValue;
CharacterController controller; //Just character Controller
Rigidbody rb; //Rigidbody shortcut is rb
void Start() {
rb = GetComponent<Rigidbody>();
controller = GetComponent<CharacterController>();
}
void FixedUpdate ()
{
//calculate forces
forceValue = new Vector3 (0,0,0);
//calculate torque
//torqueValue =new Vector3 (0,0,0);
//Fly forward
if (Input.GetKey ("w"))
{
forceValue += cameraT.forward * forceModule;
GetComponent<Rigidbody>().velocity = Vector3.ClampMagnitude(GetComponent<Rigidbody>().velocity, maxSpeed); // Max Speed while moving
}
if (Input.GetKey ("s"))
{
forceValue += -cameraT.forward * forceModule;
GetComponent<Rigidbody>().velocity = Vector3.ClampMagnitude(GetComponent<Rigidbody>().velocity, maxSpeed);
}
//APPLY FORCES
rb.AddForce (forceValue);
}