模型根据摄像机旋转

var cam : Transform;
var cameraRelativeRight : Vector3;
// Apply a force relative to the camera's x-axis
function Update()
{
   cameraRelativeRight = cam.TransformDirection (Vector3.right);
   cameraRelativeRight.y = 0;
   transform.rotation = Quaternion.RotateTowards (transform.rotation, Quaternion.LookRotation(cameraRelativeRight), 5);
}

posted @ 2011-06-20 13:35  softimagewht  阅读(205)  评论(0编辑  收藏  举报