void Start() { Debug.Log("Creating hinge"); childBody = GetComponentInParent <NewtonBody>(); Matrix4x4 matrix = Matrix4x4.identity; matrix.SetTRS(transform.position, transform.rotation, Vector3.one); IntPtr parentBodyPtr = IntPtr.Zero; if (ConnectedBody != null) { parentBodyPtr = ConnectedBody.pBody; } joint = NewtonAPI.NewtonCreateHinge(ref matrix, childBody.pBody, parentBodyPtr); NewtonAPI.NewtonHingeEnableLimits(joint, EnableLimits); NewtonAPI.NewtonHingeSetLimits(joint, MinAngle * Mathf.Deg2Rad, MaxAngle * Mathf.Deg2Rad); NewtonAPI.NewtonHingeSetFriction(joint, Friction); }