Wayback Machinekoobas.hobune.stream
May JUN Jul
Previous capture 12 Next capture
2021 2022 2023
1 capture
12 Jun 22 - 12 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 /
This question was closed Sep 28, 2017 at 09:07 AM by Trebbit for the following reason:

The question is answered, right answer was accepted

avatar image
0
Question by Trebbit · Apr 18, 2016 at 01:30 PM · updateupdating

mobile touch ios doesn't work anymore after update to 5.3.4

I was making a game when I updated unity the drag script didn't work any more I don't get any errors please help this is my script:

using UnityEngine; using System.Collections; public class Dragger: MonoBehaviour { public int maxTouch = 2; [Range(0,31)] public int layerMask = 0; public float distance = 0.2f; public float dampingRatio = 1; public float frequency = 1.8f; %|-1782931336_7|% public float angularDrag = 5.0f; public bool centerOfMass = false; private SpringJoint2D[] springJoints; void Start () { springJoints = new SpringJoint2D[maxTouch]; for (int i = 0; i < maxTouch; i++) { GameObject go = new GameObject ("Dragger" + (i + 1)); go.transform.parent = this.transform; Rigidbody2D body = go.AddComponent <Rigidbody2D>() as Rigidbody2D; springJoints [i] = go.AddComponent <SpringJoint2D>() as SpringJoint2D; %|1623580026_19|% } } void Update () { foreach (Touch touch in Input.touches) { int Id = touch.fingerId; if (Id < maxTouch && touch.phase == TouchPhase.Began) { Camera mainCamera = FindCamera (); Ray ray = mainCamera.ScreenPointToRay (touch.position); RaycastHit2D hit = Physics2D.GetRayIntersection (ray, Mathf.Infinity, 1 << layerMask); if (hit.rigidbody != null && hit.rigidbody.isKinematic == false) { springJoints [Id].transform.position = hit.point; %|-307089627_32|% %|898935706_32|% springJoints [Id].connectedAnchor = hit.rigidbody.centerOfMass; else springJoints [Id].connectedAnchor = hit.transform.InverseTransformPoint (hit.point); float length = (hit.transform.position - mainCamera.transform.position).magnitude; StartCoroutine (DragObject (Id, length)); } } } } IEnumerator DragObject (int Id, float length) { float oldDrag = springJoints [Id].connectedBody.drag; float oldAngularDrag = springJoints [Id].connectedBody.angularDrag; springJoints [Id].distance = distance; %|-411076151_49|% springJoints [Id].frequency = frequency; springJoints [Id].connectedBody.drag = linearDrag; springJoints [Id].connectedBody.angularDrag = angularDrag; Camera mainCamera = FindCamera (); while (true) { bool touchExists = false; foreach (Touch touch in Input.touches) { if (touch.fingerId == Id) { touchExists = true; Ray ray = mainCamera.ScreenPointToRay (touch.position); springJoints [Id].transform.position = ray.GetPoint (length); } %|-1491490236_62|% %|-554512503_63|% yield return null; else break; } %|-590301434_68|% %|-1983571684_64|% springJoints [Id].connectedBody.angularDrag = oldAngularDrag; springJoints [Id].connectedBody = null; } } Camera FindCamera () { if (GetComponent<Camera>()) return GetComponent<Camera>(); %|-14636753_79|% return Camera.main; } }

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

1 Reply

  • Sort: 
avatar image
0
Best Answer

Answer by Sortof · Apr 20, 2016 at 12:29 PM

I had a similar issue, and fixed it by disabling "Auto Configure Distance" for the joints.

springJoints[i].autoConfigureDistance = false;

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

Follow this Question

Answers Answers and Comments

4 People are following this question.

avatar image avatar image avatar image avatar image

Related Questions

Updating minor versions 2018.2.0 to 2018.2.1 and Unity Hub 0 Answers

Upgrading unity. Files kept? 1 Answer

Camer angle of rift shifts on start 0 Answers

Text Not updating 1 Answer

auto change script in published build 0 Answers


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