示例#1
0
    // Use this for initialization
    void Start()
    {
        thisTransform = transform;
        manager       = FindObjectOfType <PhysicsGridManager>();
        if (manager == null)
        {
            Debug.LogError("No grid manager found in scene");
        }
        if (transform.parent != null)
        {
            SetGrid(transform.parent.GetComponent <PhysicsGrid>(), true);
        }
        else
        {
            SetGrid(manager.GetGridByID((ushort)ReservedObjectIDs.RootGrid), true);
        }
        if (parentGrid == null)
        {
            Debug.Log("ZonedTransform does not have a parent grid, this should happen rarely");
        }
        debugRigidbody = GetComponent <Rigidbody>();

        IdentityContainer c = GetComponent <IdentityContainer>();

        if (c != null)
        {
            thisMNI = c.GetIdentity();
            hasIdentityContainer = true;
        }

        manager.TriggerRootScan();
    }