- Home /
 
               Question by 
               Elmdran · Jul 03, 2015 at 01:52 PM · 
                addforcemouselookforwardtransform.forward  
              
 
              Addforce forward with mouselook script
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?
               Comment
              
 
               
              Your answer
 
 
              koobas.hobune.stream
koobas.hobune.stream 
                       
                
                       
			     
			 
                