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

Addforce forward with mouselook script

$
0
0
Hello. I'm moving my gameobject like this: void Update () { float v = Input.GetAxis("Vertical"); Vector3 forwardMove = v * transform.forward * moveSpeed; rb.AddForce(forwardMove); } And I have a mouselook script that lets me freely look around. The problem I have is when I look around I keep going the direction I was going, I want my movedirection also change to be my look direction. I realize I'm adding force to my previous look rotation, but I can't figure out how to constantly have my force be in the direction I'm looking at. Thank you in advance if you can shine some light on this problem. **EDIT: I realized I had to set rb.velocity instead, but now I lost the 0 gravity slowly decreasing my movementspeed instead, how can I make it slowly go back to 0?**

Viewing all articles
Browse latest Browse all 1264

Trending Articles



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