I am using Character Controller and i want to know how to move my character using command, for example i want my character to step back (move few units backward), but it should move, not be teleported by instant.
I’ve tried to do this using “for” loop and “waitforseconds” but it’s not enough. “waitforseconds” has big limits, so even if i put “0.0000000000001” seconds it doesn’t move that fast.
Here is my function:
function jump()
{
var controller : CharacterController = GetComponent(CharacterController);
var i :byte;
for(i=1;i<=60;i++)
{
moveDirection = Vector3(0, 0, -1);
moveDirection = transform.TransformDirection(moveDirection);
moveDirection *= speed;
controller.Move(moveDirection * Time.deltaTime);
yield WaitForSeconds(0.000001);
}
}