I am trying to code a space game with Cardboard and want the spaceship to fly where you look instantly. I’ve been trying with using addForce, which kind of works but when you turn it doesn’t create the instant effect I’m looking for nor fly in the right direction.
public float thrust;
public Rigidbody rb;
void Start() {
}
void Update() {
rb.AddForce(transform.position += transform.forward * thrust * Time.deltaTime);
}
}
Then I have tried using:
transform.Translate(0, 0, thrust * Time.deltaTime, Camera.main.transform);
This is the effect I want to have using transform.Translate. Except when building the game it doesn’t work with the Cardboard and it doesn’t have the ability to collide with the world.
What is the correct way to move the Cardboard camera while flying in space?