Wayback Machinekoobas.hobune.stream
May JUN Jul
Previous capture 14 Next capture
2021 2022 2023
2 captures
12 Jun 22 - 14 Jun 22
sparklines
Close Help
  • Products
  • Solutions
  • Made with Unity
  • Learning
  • Support & Services
  • Community
  • Asset Store
  • Get Unity

UNITY ACCOUNT

You need a Unity Account to shop in the Online and Asset Stores, participate in the Unity Community and manage your license portfolio. Login Create account
  • Blog
  • Forums
  • Answers
  • Evangelists
  • User Groups
  • Beta Program
  • Advisory Panel

Navigation

  • Home
  • Products
  • Solutions
  • Made with Unity
  • Learning
  • Support & Services
  • Community
    • Blog
    • Forums
    • Answers
    • Evangelists
    • User Groups
    • Beta Program
    • Advisory Panel

Unity account

You need a Unity Account to shop in the Online and Asset Stores, participate in the Unity Community and manage your license portfolio. Login Create account

Language

  • Chinese
  • Spanish
  • Japanese
  • Korean
  • Portuguese
  • Ask a question
  • Spaces
    • Default
    • Help Room
    • META
    • Moderators
    • Topics
    • Questions
    • Users
    • Badges
  • Home /
  • Help Room /
avatar image
0
Question by Hjortebjerg · Nov 02, 2016 at 12:19 PM · touch controls

Mobile: Touchscript rescales all object even though I only drag/scale one object?

HI. Is anyone familiar with a combination of Vuforia AR SDK and the Lean touch scripts? I am creating a project in which I have multiple child objects of my image target. (a cube, a sphere etc.) When I try to add the transform functionality from the lean touch script it transforms all objects even though I only pick (and touch) one of them.

For those not familiar with the Lean touch script: I have attached a touch script to an empty gameobject. Also each object that needs to be dragged has a draggable and transform script attached. BUT when I touch and scale one object it affects all the other objects aswell. What To Do?

I have attached a image of the hierarchy and the inspector of one of the draggable objects alt text

The transform script: using UnityEngine;

 namespace Lean.Touch
 {
     // This script allows you to transform the current GameObject
     public class LeanTransform : MonoBehaviour
     {
         public bool AllowTranslate = true;
 
         public bool AllowRotate = true;
 
         public bool AllowScale = true;
 
         protected virtual void Update()
         {
             if (AllowTranslate == true)
             {
                 Translate(LeanTouch.DragDelta);
             }
 
             if (AllowRotate == true)
             {
                 Rotate(LeanTouch.TwistDegrees);
             }
 
             if (AllowScale == true)
             {
                 Scale(LeanTouch.PinchScale);
             }
         }
 
         private void Translate(Vector2 screenPositionDelta)
         {
             // Screen position of the transform
             var screenPosition = Camera.main.WorldToScreenPoint(transform.position);
             
             // Add the deltaPosition
             screenPosition += (Vector3)screenPositionDelta;
             
             // Convert back to world space
             transform.position = Camera.main.ScreenToWorldPoint(screenPosition);
         }
 
         private void Rotate(float angleDelta)
         {
             transform.rotation *= Quaternion.Euler(0.0f, 0.0f, angleDelta);
         }
 
         private void Scale(float scale)
         {
             // Make sure the scale is valid
             if (scale > 0.0f)
             {
                 // Grow the local scale by scale
                 transform.localScale *= scale;
             }
         }
     }
 }
skærmbillede-2016-11-01-kl-114528.png (152.3 kB)
skærmbillede-2016-11-01-kl-114516.png (53.4 kB)
Comment
Add comment
10 |3000 characters needed characters left characters exceeded
▼
  • Viewable by all users
  • Viewable by moderators
  • Viewable by moderators and the original poster
  • Advanced visibility
Viewable by all users

3 Replies

· Add your reply
  • Sort: 
avatar image
0

Answer by wilbertllama · Apr 25, 2017 at 08:01 PM

Hello, I'm also interested in how to scale objects separately. I searched for solutions too, but the results were not optimal. However, I would like to share them. Maybe it works for you.

option 1

Someone made a video on how he did it. (link: https://drive.google.com/file/d/0B6WOE1SuIGL3VmdfZ0EyVS05WlE/view)

He used an old version of LeanTouch. This can be found here: https://www.ourtechart.com/augmented-reality/tutorial/augmented-reality-touchscreen-events/ (Just download the whole project and copy the Lean Touch map to your project.)

It works on my Android phone for a few minutes, but after 5 minutes or less, the Scaling/Moving stops working properly.

option 2

I also found a youtube video about moving and scaling objects separately. (link: https://www.youtube.com/watch?v=KoPI1-V07aw)

With this tutorial I can move objects separately, but Scaling still does not work for me. (I followed the exact same steps of the tutorial.)

I am still figuring out how to scale the objects separately, and unfortunately, the two methods above did not work for me.

If someone already discovered how to Scale the objects individually (with or without LeanTouch), please share your solution/scripts.

Comment
Add comment · Share
10 |3000 characters needed characters left characters exceeded
▼
  • Viewable by all users
  • Viewable by moderators
  • Viewable by moderators and the original poster
  • Advanced visibility
Viewable by all users
avatar image
0

Answer by corbinyo · Apr 18, 2018 at 07:59 PM

Did you find out how to do this in the end?

Comment
Add comment · Share
10 |3000 characters needed characters left characters exceeded
▼
  • Viewable by all users
  • Viewable by moderators
  • Viewable by moderators and the original poster
  • Advanced visibility
Viewable by all users
avatar image
0

Answer by Noor23 · Jun 02 at 12:26 PM

Same issue here any results ? @hjortebjerg

Comment
Add comment · Share
10 |3000 characters needed characters left characters exceeded
▼
  • Viewable by all users
  • Viewable by moderators
  • Viewable by moderators and the original poster
  • Advanced visibility
Viewable by all users

Your answer

Hint: You can notify a user about this post by typing @username

Up to 2 attachments (including images) can be used with a maximum of 524.3 kB each and 1.0 MB total.

Follow this Question

Answers Answers and Comments

79 People are following this question.

avatar image avatar image avatar image avatar image avatar image avatar image avatar image avatar image avatar image avatar image avatar image avatar image avatar image avatar image avatar image avatar image avatar image avatar image avatar image avatar image avatar image avatar image avatar image avatar image avatar image avatar image avatar image avatar image avatar image avatar image avatar image avatar image avatar image avatar image avatar image avatar image avatar image avatar image avatar image avatar image avatar image avatar image avatar image avatar image avatar image avatar image avatar image avatar image avatar image avatar image avatar image avatar image avatar image avatar image avatar image avatar image avatar image avatar image avatar image avatar image avatar image avatar image avatar image avatar image avatar image avatar image avatar image avatar image avatar image avatar image avatar image avatar image avatar image avatar image avatar image avatar image avatar image avatar image avatar image

Related Questions

Apply code to a gameObject with EventTrigger 0 Answers

Addforce to Z axis rotation via touch input/ mobile 0 Answers

Converting Mouse to touch controls 0 Answers

Touchscreen Controls Like GetAxis 1 Answer

I want to rotate the 2D missile with touch controls 1 Answer


Enterprise
Social Q&A

Social
Subscribe on YouTube social-youtube Follow on LinkedIn social-linkedin Follow on Twitter social-twitter Follow on Facebook social-facebook Follow on Instagram social-instagram

Footer

  • Purchase
    • Products
    • Subscription
    • Asset Store
    • Unity Gear
    • Resellers
  • Education
    • Students
    • Educators
    • Certification
    • Learn
    • Center of Excellence
  • Download
    • Unity
    • Beta Program
  • Unity Labs
    • Labs
    • Publications
  • Resources
    • Learn platform
    • Community
    • Documentation
    • Unity QA
    • FAQ
    • Services Status
    • Connect
  • About Unity
    • About Us
    • Blog
    • Events
    • Careers
    • Contact
    • Press
    • Partners
    • Affiliates
    • Security
Copyright © 2020 Unity Technologies
  • Legal
  • Privacy Policy
  • Cookies
  • Do Not Sell My Personal Information
  • Cookies Settings
"Unity", Unity logos, and other Unity trademarks are trademarks or registered trademarks of Unity Technologies or its affiliates in the U.S. and elsewhere (more info here). Other names or brands are trademarks of their respective owners.
  • Anonymous
  • Sign in
  • Create
  • Ask a question
  • Spaces
  • Default
  • Help Room
  • META
  • Moderators
  • Explore
  • Topics
  • Questions
  • Users
  • Badges