Skip to content

Instantly share code, notes, and snippets.

@t-kashima
Created June 7, 2013 03:10
Show Gist options
  • Save t-kashima/5726826 to your computer and use it in GitHub Desktop.
Save t-kashima/5726826 to your computer and use it in GitHub Desktop.
なげる
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