better walk control
This commit is contained in:
Binary file not shown.
Binary file not shown.
@@ -91,6 +91,11 @@ public class Serial3 : MonoBehaviour{
|
|||||||
walk.centerRotation = rotation < 0.5f && rotation > -0.5f ? 0 : rotation;
|
walk.centerRotation = rotation < 0.5f && rotation > -0.5f ? 0 : rotation;
|
||||||
|
|
||||||
walk.walkDirection = (-1 * ConvertRadiansToDegrees((float) Math.Atan2(b2, b1)));
|
walk.walkDirection = (-1 * ConvertRadiansToDegrees((float) Math.Atan2(b2, b1)));
|
||||||
|
|
||||||
|
float rotationabs = Math.Abs(walk.centerRotation);
|
||||||
|
float speed2 = ((6 / 3) * walk.walkspeed) + ((6/5) * rotationabs);
|
||||||
|
speed2 = speed2 < 6 ? speed2 : 6;
|
||||||
|
walk.speed2 = (int)(10 - speed2);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|||||||
Reference in New Issue
Block a user