Comments (11)
Scale is multiplicative. This might be misleading but value of 1 is "no scale", 1.1 — 10% scaled up, 0.9 — 10% scaled down.
from touchscript.
That's the way i saw it, but the retreived value does not reflect the spacing between fingers..
I expected something like: "Current_FingerDistance / GestureStart_FingersDistance" that could be done in a slow & precise move (currently used to control the zoom of a camera).
from touchscript.
This is delta value. You should keep all the previous values to calculate current absolute scale.
currentScale *= delta;
It's not that simple with "start finger distance" as you pointed out because you can start with one fingers and end the gesture holding other ones.
from touchscript.
From Unity documentation : "Contains local delta scale when gesture is recognized. Value is between 0 and +infinity, where 1 is no scale, 0.5 is scaled in half, 2 scaled twice."
It sound like a value i could directly use ?
So it's not clear what you mean by storing each deltas.
The problem is that i don't get such values for it (debug.print)..
1.0 - or close on gesture recognition = no scale
0.8 - when fingers are totally close from others, + relativly linear move from "no scale" position = useable.
1.01 - when finger are as far as possible from center, + unuseable move from "no scale" position (from 1.0 to 1.12 then to 1.01) = unuseable.
ps : The rotation (the hardest one i guess) work as a charm.. i wont bother you with this one ;)
from touchscript.
No, this is delta value from previous frame.
It is like (distance between fingers this frame) / (distance between fingers last frame).
from touchscript.
My goal is not to argue, but to make it work in my project and help you improve you'r lib meanwhile.. so i need to describe the value as it is.
What i obtain from ScaleGesture.LocalDeltaScale is like : Current_FingerDistance / GestureStart_FingersDistance.
It may be different from what you intend/got, for a weird reason.. but that's bugs rules, and that's why i'm here.
from touchscript.
Sorry I lost track of what you actually want.
Do you want LocalDeltaScale to be equal to (current finger distance) / (start finger distance), right?
If so, it's not possible. LocalDeltaScale = (current finger distance) / (finger distance last frame).
So, once again, to get absolute scale value you need to store LocalDeltaScale each frame like this:
absoluteScale *= gesture.LocalDeltaScale;
absoluteScale variable will contain what you want.
from touchscript.
I've done the zoom & pan i needed directly using TouchManager.Touches.. and the rotation using your events.
So this discussion now only intend to bring feedback to you, as this lib is a nice gift that helped me a lot.
using ScaleGesture.LocalDeltaScale :
- if put some fingers and scale then down a bit, i obtain 0.99 (nearly 1.0 - triggering) : it's ok.
- if i scale then down at maximum, i obtain 0.8 (never 0.5), but the localdeltascale reflect my finger spacing : it's ok.
- if i maintain the same position, i still obtain 0.8 (so it does not sound like a delta) : but it's still ok.
then
- if i try to scale up.. i can go back from 0.8 to 1.0 with no problem.. but when scaling up, the values are non lineary linked to my fingers spacing, that's where my problem is. While i increase the finger spacing, it move from 1.0 to 1.1, then to 1.01.. i never can reach 1.5 or even 2.0.
In short : Scale down work nicely, scale up does not work.. for me.
ps : i'm french, so sorry if my english does not help understanding and/or does not reflect the friendly feeling.
from touchscript.
This doesn't sound like normal behavior. Do you have a test project you could send me to test?
from touchscript.
Preparing the sample made it clearer :
You where right from start, "absoluteScale *= gesture.LocalDeltaScale;" is perfect for this need.
So sorry for this long missunderstanding, and thanks for your patience..
Regards,
Alain.
from touchscript.
Good to know that you figured this out.
from touchscript.
Related Issues (20)
- TapGesture.Tapped not working in Android
- Camera Control
- Initial touch down on UI Slider sets Slider.value to 0 HOT 1
- Scaling an object
- Tap Gesture Not Working on WebGL (mobile only)
- Update Old Hyperlinks in `Gestures` Wiki article
- Pointers not being removed/cancelled using TUIO input HOT 5
- Triggering overlapping colliders at the same time with one click?
- Pointer.GetOverData(false) return Wrong Target
- Unity Crashes when i click on the TouchManager prefab
- Touch Detection on Multi Display Window Application HOT 1
- I can't touch on surface pro 7
- TouchScript multiple displays with tuio HOT 2
- Transforming an object without the need to touch it beforehand HOT 1
- How to receive only the raw touches that land within an object? HOT 1
- out of virtual finger IDs
- TUIO Input extra poitner issues HOT 1
- Mac osx touchpad support
- The order of the layers
- Touch duplication HOT 2
Recommend Projects
-
React
A declarative, efficient, and flexible JavaScript library for building user interfaces.
-
Vue.js
🖖 Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.
-
Typescript
TypeScript is a superset of JavaScript that compiles to clean JavaScript output.
-
TensorFlow
An Open Source Machine Learning Framework for Everyone
-
Django
The Web framework for perfectionists with deadlines.
-
Laravel
A PHP framework for web artisans
-
D3
Bring data to life with SVG, Canvas and HTML. 📊📈🎉
-
Recommend Topics
-
javascript
JavaScript (JS) is a lightweight interpreted programming language with first-class functions.
-
web
Some thing interesting about web. New door for the world.
-
server
A server is a program made to process requests and deliver data to clients.
-
Machine learning
Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.
-
Visualization
Some thing interesting about visualization, use data art
-
Game
Some thing interesting about game, make everyone happy.
Recommend Org
-
Facebook
We are working to build community through open source technology. NB: members must have two-factor auth.
-
Microsoft
Open source projects and samples from Microsoft.
-
Google
Google ❤️ Open Source for everyone.
-
Alibaba
Alibaba Open Source for everyone
-
D3
Data-Driven Documents codes.
-
Tencent
China tencent open source team.
from touchscript.