Unity3d字符旋转方向

时间:2014-02-19 11:02:46

标签: unity3d unityscript

我使用角色控制器速度来指定traform.forward方向

function FaceMovementDirection()
{   
    var horizontalVelocity : Vector3 = character.velocity;
    horizontalVelocity.y = 0; // Ignore vertical movement

    // If moving significantly in a new direction, point that character in that direction
    if (horizontalVelocity.magnitude > 0.1)
        thisTransform.forward = horizontalVelocity.normalized;
}

我的问题是当角色遇到障碍物时,该轴的速度为0并且转向侧面。 我想继续前进并面向障碍,即使它的位置没有改变

任何解决方案的想法如何做到这一点?

0 个答案:

没有答案