private void LateUpdate() { mLastFramePosition = this.transform.position; if (mHitLeft && VelX < 0) { VelX = 0; } else if (mHitRight && VelX > 0) { VelX = 0; } #if (UNITY_EDITOR) // draw the collider each frame. JCS_Debug.DrawCollider(mBoxCollider2d, Color.cyan); JCS_Debug.DrawCollider(mBoxCollider2d, Color.blue, mLastFrameColliderPosition); #endif // record down the last frame's collider's position mLastFrameColliderPosition = JCS_Physics.GetColliderPosition(mBoxCollider2d); }