- 最后登录
- 2016-8-29
- 注册时间
- 2012-8-25
- 阅读权限
- 90
- 积分
- 23585
- 纳金币
- 20645
- 精华
- 62
|
不知是否改这里的代码,请大神指导下
public class WindowDragTilt : MonoBehaviour
{
public int updateOrder = 0;
public float degrees = 30f;
Vector3 mLastPos;
Transform mTrans;
float mAngle = 0f;
bool mInit = true;
void Start () { UpdateManager.AddCoroutine(this, updateOrder, CoroutineUpdate); }
void OnEnable () { mInit = true; }
void CoroutineUpdate (float delta)
{
if (mInit)
{
mInit = false;
mTrans = transform;
mLastPos = mTrans.position;
}
Vector3 deltaPos = mTrans.position - mLastPos;
mLastPos = mTrans.position;
mAngle += deltaPos.x * degrees;
mAngle = NGUIMath.SpringLerp(mAngle, 0f, 20f, delta);
mTrans.localRotation = Quaternion.Euler(0f, 0f, -mAngle);
}
} |
|