- Home /
touch sensitive problem
Hello guys. I have a problem with touch for mobile devices. With a simple ray I choose the angle in which the bullet is fired. The problem is that the touch is too sensitive and taking aim to hit something becomes a problem. How can I "slow down" the touch to make it less sensitive?
Vector3 dir;
if (Input.GetKeyDown(KeyCode.Mouse0))
{
Ray castPoint = Camera.main.ScreenPointToRay(pos);
RaycastHit hit;
if (Physics.Raycast(castPoint, out hit))
{
dir = (cannon.gameObject.transform.position - hit.point).normalized;
angle = Mathf.Atan2(dir.y, dir.x) * Mathf.Rad2Deg;
angle = Mathf.Clamp(angle, min, max);
Quaternion rot = Quaternion.Euler(Vector3.forward * angle);
cannon.transform.rotation = rot;
}
}
Comment
Your answer
Follow this Question
Related Questions
Touch Controlled Orbit Camera 0 Answers
Mobile - button press while moving (First Person Controls) 0 Answers
Input.mousePosition equivalent to first finger touch? 3 Answers
Camera movement using touch input 0 Answers
Is there a built in method that works like OnMouseDown() but for touch input? 1 Answer