コード例 #1
0
    public FPPolygonalCollider AddPolygonalCollider(Vector2[] vertices, bool withDebugView = false)
    {
        FPPolygonalCollider fp = gameObject.AddComponent <FPPolygonalCollider>();

        fp.Init(new FPPolygonalData(vertices, false));

        if (withDebugView)
        {
            FPDebugRenderer.Create(gameObject, Futile.stage, 0x00FF00, false);
        }

        return(fp);
    }
コード例 #2
0
    public SphereCollider AddSphereCollider(float radius, bool withDebugView = false)
    {
        SphereCollider sc = gameObject.AddComponent <SphereCollider>();

        sc.radius = radius * FPhysics.POINTS_TO_METERS;

        if (withDebugView)
        {
            FPDebugRenderer.Create(gameObject, Futile.stage, 0x00FF00, false);
        }

        return(sc);
    }
コード例 #3
0
    public BoxCollider AddBoxCollider(Vector2 size, bool withDebugView = false)
    {
        BoxCollider bc = gameObject.AddComponent <BoxCollider>();

        bc.size = new Vector3(size.x * FPhysics.POINTS_TO_METERS, size.y * FPhysics.POINTS_TO_METERS, FPhysics.DEFAULT_Z_THICKNESS);

        if (withDebugView)
        {
            FPDebugRenderer.Create(gameObject, Futile.stage, 0x00FF00, false);
        }

        return(bc);
    }