Search Unity

  1. The Unity Pro & Visual Studio Professional Bundle gives you the tools you need to develop faster & collaborate more efficiently. Learn more.
    Dismiss Notice
  2. Improved Prefab workflow (includes Nested Prefabs!), 2D isometric Tilemap and more! Get the 2018.3 Beta now.
    Dismiss Notice
  3. Want more efficiency in your development work? Sign up to receive weekly tech and creative know-how from Unity experts.
    Dismiss Notice
  4. Participate with students all over the world and build projects to teach people. Join now!
    Dismiss Notice
  5. Build games and experiences that can load instantly and without install. Explore the Project Tiny Preview today!
    Dismiss Notice
  6. Improve your Unity skills with a certified instructor in a private, interactive classroom. Watch the overview now.
    Dismiss Notice
  7. Want to see the most recent patch releases? Take a peek at the patch release page.
    Dismiss Notice

I'm slowly losing my mind.... empty child gameobject inheriting parent aircraft physics....

Discussion in 'AR/VR (XR) Discussion' started by Dingledorf, Dec 7, 2018 at 1:01 PM.

  1. Dingledorf

    Dingledorf

    Joined:
    Nov 24, 2012
    Posts:
    14
    Hello,

    Please help, I have an airplane full exterior and full interior cockpit modeled and with full aircraft physics.
    I have setup controls that are fully controllable with VR hands, no input device needed.
    Here is my issue. I need the cockpit interior model to not be effected by the parent aircraft physics/forces at all.

    I thought that if I place the cockpit outside of the aircrafts hierarchy and instead place and empty gameobject where the cockpit should be (inside the hierarchy), I can just reference that empty gameobject's transform position and that would be it.However it doesn't work, I mean it does work, it places the cockpit inside the aircraft which is great, but the cockpit model is still effected by the aircraft physics which basically makes controlling the flight stick and throttle with VR hands very difficult because multiple forces are being applied.

    What am I doing wrong?

    Here is an example of the script:

    public class CockpitGhostScript : MonoBehaviour {

    public GameObject myFirstObjectReference;
    public GameObject mySecondObjectReference;


    // Use this for initialization
    void Start () {

    myFirstObjectReference = GameObject.Find("Outside_Cockpit");
    mySecondObjectReference = GameObject.Find("Inside_Cockpit");

    }

    // Replace empty transform with cockpit model
    void Update () {

    myFirstObjectReference.transform.position = mySecondObjectReference.transform.position;

    }
    }
     
    Last edited: Dec 7, 2018 at 1:39 PM
  2. Dingledorf

    Dingledorf

    Joined:
    Nov 24, 2012
    Posts:
    14
    Fixed! I removed OVR rig and Cockpit from the Aircraft and used position/rotation constraints to stop any unwanted forces.