Search Unity

Question Moving "Immovable" articulation bodies?

Discussion in 'Physics' started by Airmouse, May 10, 2023.

  1. Airmouse

    Airmouse

    Joined:
    Jan 12, 2019
    Posts:
    107
    When I set a articulation body to Immovable I am no longer able to move the object in the editor while playing the game. This is unexpected since moving Kinematic rigidbodies is allowed.

    Why can't I move a Immovable articulation body from editor or code?

    How do I move the immovable articulation body to a new location?

    The object is stuck in one place and I can't understand how to use articulation bodies when the root object can't be moved???

    [EDIT]
    Even moving the parent of the articulation body only causes some object to move, but the joints stay locked in a global position causing the objects to become stretched apart, this is not expected behavior!!

    How do I move a articulation body root?? Thanks
     
    Last edited: May 10, 2023
  2. tjmaul

    tjmaul

    Joined:
    Aug 29, 2018
    Posts:
    467
  3. SirLogray

    SirLogray

    Joined:
    Mar 31, 2016
    Posts:
    3
    Experiment with this (old Input System just to get you started):
    Code (CSharp):
    1.     ArticulationBody root = new();
    2.  
    3.     float movementSpeed = 0.01f;
    4.  
    5.     private void Start()
    6.     {
    7.         root = GetComponent<ArticulationBody>();
    8.         //root.TeleportRoot(transform.position + Vector3.up * 3, transform.rotation);
    9.     }
    10.  
    11.     void FixedUpdate()
    12.     {
    13.         if (Input.GetAxis("Mouse X") != 0)
    14.         {
    15.             int sign = Math.Sign(Input.GetAxis("Mouse X"));
    16.             root.TeleportRoot(transform.position + movementSpeed * sign * Vector3.left, transform.rotation);
    17.         }
    18.  
    19.         if (Input.GetAxis("Mouse Y") != 0)
    20.         {
    21.             int sign = Math.Sign(Input.GetAxis("Mouse Y"));
    22.             root.TeleportRoot(transform.position + movementSpeed * sign * Vector3.forward, transform.rotation);
    23.         }
    24.     }