Skip to content

Conversation

@kevin-d-omara
Copy link

Why?

I added this option because controlling a camera's translation, rotation, and scaling at the same time was too fiddly. For example, rotating would also zoom the camera. This way, a person can rotate without worrying about zooming, zoom without translating, etc.

What?

Can now disallow multiple types of transformations to occur each time a
gesture is used.

For example, when a gesture is used to rotate it cannot scale or
translate. Once the gesture ends it is reset and can again be used for
any type of transformation.

There is a checkbox in the inspector to select this option. It is under
Advanced > General > Simultaneous Transforms.

It works for both One- and Two- Point transformations, including
two-finger translation, 2+ finger transformations, and clustered
transforms.

How?

Here's a picture explaining how I determine which gesture to lock into:

nonsimultaneous transform logic

Can now disallow multiple types of transformations to occur each time a
gesture is used.

For example, when a gesture is used to rotate it cannot scale or
translate. Once the gesture ends it is reset and can again be used for
any type of transformation.

There is a checkbox in the inspector to select this option. It is under
Advanced > General > Simultaneous Transforms.

It works for both One- and Two- Point transformations, including
two-finger translation, 2+ finger transformations, and clustered
transforms.
@valyard
Copy link
Contributor

valyard commented Sep 20, 2017

Hm... can't you just have the same effect with two gestures, each set up to translation/rotation only?

@kevin-d-omara
Copy link
Author

Great idea! I just tried it out (three gestures: one each for translation, rotation, and scaling). It does restrict transformations to a single type per use (like my proposed changes). Unfortunately, it behaves erratically.

For example, a "zoom out" sometimes rotates instead. This is because the fingers don't travel in a perfectly straight line outwards. They tend to make a shallow "V", which triggers rotation. Also, translation is sometimes scale or rotate instead.

Note: I required translation to have a minimum of two pointers because the game I'm working on needs camera panning to be done with two fingers, not one.

Previously, if a transform type was not allowed (i.e. rotation), but the
finger movement for that type was made, the gesture would still get
locked into that type.
@valyard
Copy link
Contributor

valyard commented Sep 28, 2017

Hm... I'll experiment with this. I don't see why 3 gestures (set up with the same constraints) is different then your approach.

@kevin-d-omara
Copy link
Author

Thanks for looking into it.

Note: you must experiment on an actual touch device. The simulated pointers move perfectly parallel/perpendicular and so the issue won't arise.

Let me try to explain the difference:

3 Gestures

  • When fingers move, the first gesture to be recognized cancels the other gestures.

There's the problem (in bold). Fingers rarely travel in perfectly parallel/perpendicular lines. So, a scale gesture likely includes a small amount of rotation, etc. Thus, the intended gesture is cancelled if the small change is recognized before the large change. (i.e. the scale gesture gets cancelled by the small magnitude rotation)

Proposed Changes

  • When fingers move, the direction of movement is analyzed to determine which transform type is intended by the user.

Instead of relying on the order gestures are checked, we explicitly determine the desired transform type (see original post). This way, small magnitude changes are filtered out.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

2 participants