hey gang Trying to put y Player controller to use rigidBodies to players can fly into walls and things,
trying to Figure out “Fly by mouse” Using the mouse to fly around. (third person space-shooter)
I managed to do it with translate but Trying to make it work with rigidBodies so i can have collisions.
{
public int maxSpeed = 70;
public int minSpeed = 10;
public float rotationSpeed = 150;
public int currrentSpeed = 30;
public Rigidbody rb;
void Start(){
rb = GetComponent<Rigidbody>();
}
void LateUpdate()
{
if (photonView.isMine == true) {
// Boost Break Controll:------------------------------------------------
if (Input.GetButton ("Boost")) {
currrentSpeed = 90;
} else{
currrentSpeed = 70;
}
//----------------------------------------------------------------------
if (Input.GetButton ("Break")) {
currrentSpeed = 20;
} else{
currrentSpeed = 70;
}
//----------------------------------------------------------------------
//Fly By Mouse.
// Use AddForece for Physics.
rb.AddForce(transform.forward * currrentSpeed);
}
}
}