- Home /
How do I detect a mouse click in only one half of a circle?
Basicaly, I'm making a simple game to learn how Unity works and the game is: when you click on the circle, it "bounces", but I want it to bounce to the right when I click on the left half and to the left when I click on the right half. How do I do this in C#, on Unity 5 (2D)? I'm using VS2015 to make the scrpts.
Answer by FortisVenaliter · Jan 27, 2016 at 06:15 PM
Easy. You determine the center-point of the circle (depends on how you've set them up), then when you detect a click on the circle, simply check if the value of Input.mousePosition.x is less than (left) or greater than (right) the center point's x coordinate.
Your answer
![](https://koobas.hobune.stream/wayback/20220612061947im_/https://answers.unity.com/themes/thub/images/avi.jpg)
Follow this Question
Related Questions
move UI object to click position 1 Answer
How to make 3D object become the cursor? 2 Answers
Rotate around a circle 0 Answers
Collider priority with onMouseDown() 2 Answers
Spawn prefab where i click. 1 Answer