纳金网

标题: 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);



为什么他给椭圆的刚体加力,他会平移而不会倒下去呢???




欢迎光临 纳金网 (http://go.narkii.com/club/) Powered by Discuz! X2.5