Created
August 29, 2019 10:04
-
-
Save clavis-magna/2134fad715fc4f3352f6654d030d1ced to your computer and use it in GitHub Desktop.
[Unity c#] given an angle and a radius, get a cartesian co-ordinate
This file contains 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
// what is the position on a circumference? | |
// given a radius of 'radius' | |
// need to make relative to the object when touched | |
// eg: (x, y) = (12 * sin(115.toRadian), 12 * cos(115.toRadian)) | |
float xPosOnradius = radius * Mathf.Sin(degree * Mathf.Deg2Rad) + transform.position.x; | |
float zPosOnradius = radius * Mathf.Cos(degree * Mathf.Deg2Rad) + transform.position.z; | |
float yPos = this.transform.position.y; |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment