Timeline for How do I write a script for Unity that allows a gameobject to be scaled using pinch & zoom touch controls?
Current License: CC BY-SA 4.0
8 events
| when toggle format | what | by | license | comment | |
|---|---|---|---|---|---|
| Nov 19, 2021 at 14:41 | comment | added | DMGregory♦ |
It looks like you should be able to hybridize this with one of the scripts you found for pinch-zoom. Take the zoom amount calculated in the pinch-zoom script, and use it to make your newScaleValue in this script. Take the center point of the touches involved in the pinch, and use that as the position. That should give you everything you need to adapt this script to work with touch. How have you tried to make this adaptation so far?
|
|
| Nov 19, 2021 at 13:44 | history | edited | user3797758 | CC BY-SA 4.0 |
added code from comments
|
| Nov 19, 2021 at 12:00 | comment | added | Hzata | just updating the link because unity answers is hiding it forum.unity.com/threads/… | |
| Nov 19, 2021 at 11:06 | comment | added | Hzata | I've been using this script below to achieve the same effect using the mouse scroll but I can't figure out how to make it work for touch controls. Thanks for the quick reply! link to code couldn't paste whole code sorry | |
| Nov 19, 2021 at 3:57 | review | Close votes | |||
| Dec 4, 2021 at 3:08 | |||||
| Nov 18, 2021 at 23:24 | comment | added | DMGregory♦ |
Presumably you considered taking one of these scripts you found, and replacing modifications to camera.orthographicSize or camera.fieldOfView or camera.transform.position with a corresponding change to gameObject.transform.localScale instead? Show us how you've attempted to solve this problem and where you still need help.
|
|
| S Nov 18, 2021 at 20:42 | review | First questions | |||
| Nov 19, 2021 at 13:44 | |||||
| S Nov 18, 2021 at 20:42 | history | asked | Hzata | CC BY-SA 4.0 |