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. Dismiss Notice

Bug Configurable joint swapBodies swaps objects

Discussion in 'Physics' started by csokap, Jun 8, 2023.

  1. csokap

    csokap

    Joined:
    May 8, 2023
    Posts:
    1
    Hi,
    I have two objects connected with a configurable joint, using the following settings.
    Screenshot from 2023-06-08 11-10-14.png
    When I set swapBodies to true from a Start function when it is already ticked in the inspector and the linear motions are locked, it swaps the objects.
    Code (CSharp):
    1. using System.Collections;
    2. using System.Collections.Generic;
    3. using UnityEngine;
    4.  
    5. public class test : MonoBehaviour
    6. {
    7.     private ConfigurableJoint joint;
    8.  
    9.     void Start()
    10.     {
    11.         joint = transform.GetComponent<ConfigurableJoint>();
    12.         joint.swapBodies = true;
    13.     }
    14. }
    I am using Unity 2020.3.30f1 on ubuntu.
    Here's a screencap:
    swapBodies.gif
    Is it working as intended, and I am misunderstanding something, or is this a bug?
    Thanks in advance.