Search Unity

how to change the low angular x limit parameter

Discussion in 'Scripting' started by Trild123787898, Jan 15, 2020.

  1. Trild123787898

    Trild123787898

    Joined:
    Dec 9, 2018
    Posts:
    206
    how to change the low angular x limit parameter in configurable joint in real time?
     
  2. StarManta

    StarManta

    Joined:
    Oct 23, 2006
    Posts:
    8,775
    Haven't done this specifically, but it looks like it should work the same as changing a transform's position:
    Code (csharp):
    1. var thisLimit = GetComponent<ConfigurableJoint>().angularXLimit;
    2. thisLimit.limit = something;
    3. GetComponent<ConfigurableJoint>().angularXLimit = thisLimit;
     
  3. Trild123787898

    Trild123787898

    Joined:
    Dec 9, 2018
    Posts:
    206
    no, it doesn’t help, I need to say that when the key is pressed, the limit parameter changes, let's say 10
     
  4. matthia6

    matthia6

    Joined:
    Nov 24, 2020
    Posts:
    9
    HERE iT IS!!!!
    SoftJointLimit limit = joint.angularXLimit; //First we get a copy of the limit we want to change
    limit.limit = 0.5f; //set the value that we want to change
    joint.angularXLimit = limit;//SAVES VALUE
     
  5. StarManta

    StarManta

    Joined:
    Oct 23, 2006
    Posts:
    8,775
    You mean the exact thing I posted 2 comments above yours?