Exemplo n.º 1
0
    static void ConvertEdges()
    {
        foreach (EdgeCollider2D Edge in FindObjectsOfType <EdgeCollider2D>())
        {
            GameObject          ob     = Edge.gameObject;
            LPFixtureChainShape lpEdge = Undo.AddComponent <LPFixtureChainShape>(ob);

            lpEdge.DefinePoints(LPShapeTools.Vec2ArrayToVec3Array(Edge.points));
            CopyGeneric(Edge, lpEdge);

            Undo.DestroyObjectImmediate(Edge);

            Setupdynamics(ob);
        }
    }
Exemplo n.º 2
0
    void MakeChainFix()
    {
        //Add an LPFixtureChainShape to the gameobject (LPBody is required so is added automatically)
        LPFixtureChainShape fix = ChainFix.AddComponent <LPFixtureChainShape>();

        //Call DefinePoints to set the polys points programmatically
        fix.DefinePoints(Points);

        //Set up the body how we want
        LPBody bod = ChainFix.GetComponent <LPBody>();

        bod.BodyType = LPBodyTypes.Dynamic;

        //Call initialise on the LPBody component passing in the LPManager component
        bod.Initialise(FindObjectOfType <LPManager>());
    }