So the problem that I’m facing is that when I drag the handle to right the angle of the incoming ray increases which is good but the problem arises when I want to reduce the angle. What I can identify is that since even by dragging slider to left the value remains positive Unity increases the angle.
Is there any way to identify the direction in which the handle is being dragged and increase/ decrease the angle accordingly?
this is method I’ve written, it only increase the angle:
public void rotateLaser() { if (rotateSlider.direction == Slider.Direction.LeftToRight) { Light.SetPosition (0, startingPt.position); Laser.transform.RotateAround (endingPt.position, Vector3.forward, 10f); Light.SetPosition (1, endingPt.position); } if (rotateSlider.direction == Slider.Direction.RightToLeft) { Light.SetPosition (0, startingPt.position); Laser.transform.RotateAround (endingPt.position, Vector3.forward, -10f); Light.SetPosition (1, endingPt.position); } }
Thanks! in advance.