0
\$\begingroup\$

I am letting the user to swipe around in some movement and to see the scene on mobile device.
Facing too fast swipe.
Need to make swipe slower, smother.Using the code:

foreach(Touch touch in Input.touches)
{
    transform.localEulerAngles = new Vector3(
        transform.localEulerAngles.x + touch.deltaPosition.y, transform.localEulerAngles.y + touch.deltaPosition.x, transform.localEulerAngles.z);
}
\$\endgroup\$
4
  • \$\begingroup\$ Multiplying deltaPosition on a scalar won't work? \$\endgroup\$
    – Ocelot
    Jan 26 '18 at 11:46
  • \$\begingroup\$ @Ocelot can you please show me an example? \$\endgroup\$ Jan 26 '18 at 12:53
  • \$\begingroup\$ transform.localEulerAngles.x + touch.deltaPosition.y * scalar where scalar is whatever you want it to be - 0.5 will make it twice slower, 2.0 will make it twice faster. \$\endgroup\$
    – Ocelot
    Jan 26 '18 at 15:03
  • \$\begingroup\$ you can add an answer and I will mark it. It helped. Thank you \$\endgroup\$ Jan 26 '18 at 15:26
1
\$\begingroup\$

You can control the movement speed by multiplying touch.deltaPosition values on a scalar.

transform.localEulerAngles.x + touch.deltaPosition.y * scalar

Where scalar is whatever you want it to be - 0.5 will make it twice slower, 2.0 will make it twice faster.

\$\endgroup\$

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service, privacy policy and cookie policy

Not the answer you're looking for? Browse other questions tagged or ask your own question.