- 最后登录
- 2013-12-4
- 注册时间
- 2013-11-25
- 阅读权限
- 10
- 积分
- 34
- 纳金币
- 1
- 精华
- 0
|
Please try this one, I hope it can help you
private List<float> rotArrayX = new List<float>();
float rotationX = 0F;
float rotAverageX = 0F;
public float sensitivityX = 15F;
rotAverageX = 0f;
rotationX += Input.GetAxis("Mouse X") * sensitivityX;
rotArrayX.Add(rotationX);
if (rotArrayX.Count >= frameCounter) {
rotArrayX.RemoveAt(0);
}
for(int i = 0; i < rotArrayX.Count; i++) {
rotAverageX += rotArrayX[i];
}
rotAverageX /= rotArrayX.Count;
Quaternion xQuaternion = Quaternion.AngleAxis (rotAverageX, Vector3.up);
transform.localRotation = originalRotation * xQuaternion; |
|