Quantcast
Channel: Questions in topic: "addforce"
Viewing all articles
Browse latest Browse all 1264

ADD-FORCE player fly by mouse?

$
0
0
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(); } 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); } } }

Viewing all articles
Browse latest Browse all 1264

Trending Articles



<script src="https://jsc.adskeeper.com/r/s/rssing.com.1596347.js" async> </script>