Created
June 7, 2013 03:10
-
-
Save t-kashima/5726826 to your computer and use it in GitHub Desktop.
なげる
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
void OnDrag(Vector2 delta) { | |
Vector2 mousePoint = UICamera.currentCamera.ScreenToWorldPoint(UICamera.lastTouchPosition); | |
double radian = Math.Atan2(-1 * mousePoint.y, -1 * mousePoint.x); | |
moveX = (float)Math.Cos(radian) * 60; | |
moveY = (float)Math.Sin(radian) * 60; | |
} | |
void OnMouseUp() { | |
rigidbody.AddForce (moveX, moveY, 0); | |
} |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment