标题: AngryBots里面的Player移动的代码 [打印本页] 作者: may 时间: 2013-4-30 20:41 标题: AngryBots里面的Player移动的代码 public var walkingSpeed : float = 5.0;
public var walkingSnappyness : float = 50;
public var turningSmoothing : float = 0.3;
function FixedUpdate () {
// Handle the movement of the character
var targetVelocity : Vector3 = movementDirection * walkingSpeed;
var deltaVelocity : Vector3 = targetVelocity - rigidbody.velocity;
if (rigidbody.useGravity)
deltaVelocity.y = 0;
rigidbody.AddForce (deltaVelocity * walkingSnappyness, ForceMode.Acceleration);