public void Reset(XftEventComponent client) { m_client = client; if (m_client.CameraShakeType == XCameraShakeType.Spring) { if (PositionSpring != null && !CheckDone()) { //last event shake has not finished, so set the client pos to original pos. transform.localPosition = mOriPosition; transform.localRotation = Quaternion.Euler(mOriRotation); } //reset spring PositionSpring = new Spring(client.transform, Spring.TransformType.Position); PositionSpring.MinVelocity = 0.00001f; RotationSpring = new Spring(client.transform, Spring.TransformType.Rotation); RotationSpring.MinVelocity = 0.00001f; PositionSpring.Stiffness = new Vector3(m_client.PositionStifness, m_client.PositionStifness, m_client.PositionStifness); PositionSpring.Damping = Vector3.one - new Vector3(m_client.PositionDamping, m_client.PositionDamping, m_client.PositionDamping); RotationSpring.Stiffness = new Vector3(m_client.RotationStiffness, m_client.RotationStiffness, m_client.RotationStiffness); RotationSpring.Damping = Vector3.one - new Vector3(m_client.RotationDamping, m_client.RotationDamping, m_client.RotationDamping); m_client.transform.localPosition = transform.localPosition; m_client.transform.localRotation = transform.localRotation; PositionSpring.RefreshTransformType(); RotationSpring.RefreshTransformType(); m_earthQuakeTimeTemp = m_client.EarthQuakeTime; mLastPosition = transform.localPosition; mLastRotation = transform.localRotation.eulerAngles; mOriPosition = transform.localPosition; mOriRotation = transform.localRotation.eulerAngles; } //NOTE: NEED TO APPLY THE M_CLIENT'S elapsedTime = 0 first. Update(); }