Rotating rigidbody problem
HI! I'm trying to rotate a rigidbody but isnt working.... Here is the code:
var hor : float;
var ver : float;
hor = Input.GetAxisRaw("Horizontal");
ver = Input.GetAxisRaw("Vertical");
function turnPlayer(hor : float, ver : float)
{
var targetDirection : Vector3 = new Vector3(hor, 0, ver);
var targetRotation : Quaternion = Quaternion.LookRotation (targetDirection, Vector3.up);
var newRotation : Quaternion = Quaternion.Lerp (rb.rotation, targetRotation, turnSpeed * Time.deltaTime);
rb.MoveRotation (newRotation);
}
You can see anything wrong? The hor and var are working good, but my player still pointing at same direction allways.
Comment
Hi!
turnSpeed is on 12 but i try more values like 500 but nothing