Where to find original unity Parent/Child script?

okay so i’m very interested in Unitys original parent-child code/script. I know you can find some scripts in Assets but i’m not sure if any of these involves the parent-child code/script. The reason why i want to see this code/script is because i’m interested how they did the whole child/parent thing.

I would guess they haven’t released it for the general public and if that is the case, does anyone know a script that basicly does the same thing as the parent-child function? I got an idea how to do it but i’m pretty much walking in the dark.

To be specific, i mean the way a (child) gameobject copies a (Parent) gameobjects movement, and rotates and moves relative to the (parent) gameobjects movement and rotation

Thanks for reading.

It’s not a script, it’s a physical truth. Like gravity. Child objects just do inherit from their parents.

The nitty-gritty is that (like any 3D app), you render everything with matrices. As you render an object, you add that object’s transform to the current matrix. Then you render each of that object’s children. As you go back up the tree, you pop off the changes which that child made to the render matrix.

If you somehow want a child that isn’t a child but it is (but it’s really not), I guess you could:

class NotAChild extends MonoBehaviour {
  var rotation : Quaternion;
  var position : Vector3;
  var scale : Vector3;
  var tx : Transform; 
  function Awake() { tx = transform; }
}

class NotAParent extends MonoBehaviour {
  var notChildren : NotAChild[];

  function Update() {
    for ( var nac : NotAChild in notChildren ) {
      nac.tx.position = transform.position + transform.TransformPoint(nac.position);
      nac.tx.rotation = transform.somethingprobably( nac.rotation );
      nac.tx.localScale = memberwise multiply( transform.localScale * nac.scale);
    }
  }
}

With a little help from Loius here i managed to get it to work the way i wanted. This isn’t necessarily the actual physical truth of how parent/child works. But it was the thing i needed to get what i wanted so i thought that i’d atleast post how i solved it to help anyone who might be looking for the same thing as me.
I have a camera, and this camera can hold an object. The object will always be infront of the camera. This is the code.

Vector3 front = transform.rotation * (Vector3.forward * WieldRange);
WieldedObject.transform.position = front + transform.position;

Wielrange will decide how great the distance is between you and the object you’re holding(WieldedObject).