Search Unity

  1. Welcome to the Unity Forums! Please take the time to read our Code of Conduct to familiarize yourself with the forum rules and how to post constructively.
  2. We have updated the language to the Editor Terms based on feedback from our employees and community. Learn more.
    Dismiss Notice
  3. Join us on November 16th, 2023, between 1 pm and 9 pm CET for Ask the Experts Online on Discord and on Unity Discussions.
    Dismiss Notice

5.4 breaks SimpleCCD IK when scale.x = -1

Discussion in '2D' started by chdrvn, Jul 28, 2016.

  1. chdrvn

    chdrvn

    Joined:
    Dec 4, 2013
    Posts:
    23
    Ive been using the simpleCCD.cs IK script for awhile now (
    ).
    Just installed 5.4 and my connections start spinning around like crazy when my character is flipped(scale.x = -1).

    When I comment out this line:
    // Flip sign if character is turned around
    angle *= Mathf.Sign(transform.root.localScale.x);

    it stops the spinning, but the angle limits are still backwards. Looking through the release notes briefly I dont see anything that should affect the 2d physics like this. Everything worked fine for many previous versions of unity.

    Any one else experiencing this? Or bored enough to help a brother out?
     
    MrEsquire likes this.
  2. chdrvn

    chdrvn

    Joined:
    Dec 4, 2013
    Posts:
    23
    Last edited: Aug 5, 2016
  3. sir_luke

    sir_luke

    Joined:
    Aug 19, 2014
    Posts:
    46
    Hey, thank you for posting the solution, you saved me lots of headaches... But I'm still asking myself what broke the code in 5.4: I guess the problem was in the ClampAngle method, which stopped working with "flipped" angles (angle *= Mathf.Sign(AngleSignTransform.localScale.x)...
    Is something changed with localScale inheritance in 5.4?