{
if (Input.GetKey(segment.left.keyCode) || Input.GetKey(segment.right.keyCode))
{
- segment.left.leg.transform.localRotation =
- Quaternion.Euler(0, 0, maxLegAngle * Mathf.Sin(Time.time * legSpeed));
- segment.right.leg.transform.localRotation =
- Quaternion.Euler(0, 0, maxLegAngle * Mathf.Sin(Time.time * -legSpeed));
+ segment.left.leg.transform.localRotation = Quaternion.Slerp(
+ segment.left.leg.transform.localRotation,
+ Quaternion.Euler(0, 0, maxLegAngle * Mathf.Sin(Time.time * legSpeed * (segment.Rigidbody.velocity.magnitude / 5f))),
+ Time.deltaTime * 50f
+ );
+ segment.right.leg.transform.localRotation = Quaternion.Slerp(
+ segment.right.leg.transform.localRotation,
+ Quaternion.Euler(0, 0, maxLegAngle * Mathf.Sin(Time.time * -legSpeed * (segment.Rigidbody.velocity.magnitude / 5f))),
+ Time.deltaTime * 50f
+ );
}
else
{