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
    Commented Jan 26, 2018 at 11:46
  • \$\begingroup\$ @Ocelot can you please show me an example? \$\endgroup\$ Commented Jan 26, 2018 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
    Commented Jan 26, 2018 at 15:03
  • \$\begingroup\$ you can add an answer and I will mark it. It helped. Thank you \$\endgroup\$ Commented Jan 26, 2018 at 15:26

1 Answer 1

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\$

You must log in to answer this question.

Not the answer you're looking for? Browse other questions tagged .