Exemple #1
0
        private Body CreateUfoBody()
        {
            // Creates a body but with no shape
            // Set it to ignore gravity (this is a UFO after all!). Uses AngularDamping to avoid fast rotation
            var body = new Body(World, bodyType: BodyType.Dynamic)
            {
                IgnoreGravity = true, AngularDamping = 20
            };

            // The body of the ufo consists of an ellipsis and a circle
            var ellipseVertices = PolygonTools.CreateEllipse(ConvertUnits.ToSimUnits(29), ConvertUnits.ToSimUnits(14), 16);

            ellipseVertices.Translate(ConvertUnits.ToSimUnits(0, 9));
            var ellipseShape = new PolygonShape(ellipseVertices, 5f);

            body.CreateFixture(ellipseShape);

            var circleVertices = PolygonTools.CreateCircle(ConvertUnits.ToSimUnits(15), 16);

            circleVertices.Translate(ConvertUnits.ToSimUnits(0, -5));
            var circleShape = new PolygonShape(circleVertices, 5f);

            body.CreateFixture(circleShape);

            return(body);
        }
Exemple #2
0
        public override JabActor CreateSphere(float radius, Vector2 pos, JabActor.BodyType bodytype)
        {
            try
            {
                radius /= 100;
                FarActor actor = new FarActor();
                actor.body          = new Body(world);// world.CreateBody();
                actor.body.UserData = actor;

                Vector2 center = new Vector2(-radius, -radius) / 2.0f;
                //  FarseerPhysics.Settings.MaxPolygonVertices = 33;
                Vertices sphere = PolygonTools.CreateCircle(radius, 32);

                PolygonShape shape = new PolygonShape(sphere, 1.0f);
                actor.BodyState = bodytype;
                actor.body.CreateFixture(shape, 1.0f);
                actor.Position = pos;
                actor.Width    = radius;
                actor.Height   = radius;

                actors.Add(actor);
                return(actor);
            }
            catch (Exception e)
            {
                return(null);
            }
        }
        protected override void LoadContent(PloobsEngine.Engine.GraphicInfo GraphicInfo, PloobsEngine.Engine.GraphicFactory factory, PloobsEngine.SceneControl.IContentManager contentManager)
        {
            tile = factory.GetTexture2D("Textures/tile");


            FarseerWorld fworld = this.World.PhysicWorld as FarseerWorld;

            ///border
            border = new Border(fworld, factory, GraphicInfo, factory.CreateTexture2DColor(1, 1, Color.Red));

            ///from texture, scale usage sample
            {
                Texture2D tex = factory.GetTexture2D("Textures//goo");
                tex = factory.GetScaledTexture(tex, new Vector2(3));
                IModelo2D model            = new SpriteFarseer(tex);
                Basic2DTextureMaterial mat = new Basic2DTextureMaterial();
                FarseerObject          fs  = new FarseerObject(fworld, tex);
                fs.Position         = new Vector2(0, 50);
                partobj             = new I2DObject(fs, mat, model);
                partobj.OnHasMoved += new PloobsEngine.SceneControl._2DScene.OnHasMoved(o_OnHasMoved);
                this.World.AddObject(partobj);
            }

            Vertices verts = PolygonTools.CreateRectangle(150, 150);

            {
                IModelo2D model            = new SpriteFarseer(factory, verts, Color.Green);
                Basic2DTextureMaterial mat = new Basic2DTextureMaterial();
                FarseerObject          fs  = new FarseerObject(fworld, model, 1, BodyType.Dynamic);
                I2DObject o = new I2DObject(fs, mat, model);
                ///the origin of the created object will be in the center of it, this mean: if we draw it, the center of mass of it will be on the midle of the screen
                ///We need to translate it a bit down
                o.PhysicObject.Position = new Vector2(100, 100);
                this.World.AddObject(o);
            }

            //circle
            verts = PolygonTools.CreateCircle(150, 150);
            {
                IModelo2D model            = new SpriteFarseer(factory, verts, Color.Orange);
                Basic2DTextureMaterial mat = new Basic2DTextureMaterial();
                FarseerObject          fs  = new FarseerObject(fworld, model, 1, BodyType.Dynamic);
                I2DObject o = new I2DObject(fs, mat, model);
                o.PhysicObject.Position = new Vector2(-100, -100);
                this.World.AddObject(o);
            }

            ///camera
            this.World.Camera2D = new Camera2D(GraphicInfo);

            DPFSParticleSystem ps = new DPFSParticleSystem("TESTE", new SpriteParticleSystem(null));

            this.World.ParticleManager.AddAndInitializeParticleSystem(ps);

            ///updateable
            ju = new JointUpdateable(this, fworld, this.World.Camera2D);

            base.LoadContent(GraphicInfo, factory, contentManager);
        }
Exemple #4
0
        public Barrier(Texture2D texture, Unit start, Unit end, World world, Game game, Color color)
            : base(texture, Vector2.Zero, DrawingHelper.DrawingLevel.Low, game, world)
        {
            Color           = color;
            EffectParticles = new ParticleEngine(30, texture, Vector2.Zero, color, Vector2.Zero, 1, 0, 10, DrawingHelper.DrawingLevel.Top, game);
            SyncedGameCollection.ComponentCollection.Add(EffectParticles);

            // Units to follow
            _start = start;
            _end   = end;

            // create two static hiddenBodies that mirror the position of the units
            hiddenBody1 = BodyFactory.CreateCircle(world, texture.Width / 2, 1, _start.RigidBody.Position); //_start.RigidBody;
            hiddenBody2 = BodyFactory.CreateCircle(world, texture.Width / 2, 1, _end.RigidBody.Position);   //_end.RigidBody;
            hiddenBody1.CollisionCategories = Category.None;
            hiddenBody2.CollisionCategories = Category.None;
            hiddenBody1.CollidesWith        = Category.None;
            hiddenBody2.CollidesWith        = Category.None;
            hiddenBody1.BodyType            = BodyType.Static;
            hiddenBody2.BodyType            = BodyType.Static;
            hiddenBody1.Position            = _start.RigidBody.Position;
            hiddenBody2.Position            = _end.RigidBody.Position;
            hiddenBody1.UserData            = hiddenBody2.UserData = "";

            // create path object and set it to the init position.
            Path barrierPath = new Path();

            barrierPath.Add(start.RigidBody.Position);
            barrierPath.Add(end.RigidBody.Position);
            barrierPath.Closed = false;

            // create barrier particle
            Vertices barrierParticle = PolygonTools.CreateCircle(ConvertUnits.ToSimUnits(texture.Width * 4), 8);
            Shape    shape           = new PolygonShape(barrierParticle, 0f);

            // distribute barrierParticle positions along the path between the two units.
            _barrierBodies = PathManager.EvenlyDistributeShapesAlongPath(world, barrierPath, shape, BodyType.Dynamic, 30);

            // fix the shapes together with the end and start point
            JointFactory.CreateRevoluteJoint(world, hiddenBody1, _barrierBodies[0], new Vector2(0f, 0f));
            JointFactory.CreateRevoluteJoint(world, hiddenBody2, _barrierBodies[_barrierBodies.Count - 1], new Vector2(0f, 0f));

            // fix all the barrierParticles together in the path
            PathManager.AttachBodiesWithRevoluteJoint(world, _barrierBodies, new Vector2(0f, 0.5f), new Vector2(0f, 0.5f), false, false);

            // Set up OnCollision fale safe.
            for (int i = 0; i < _barrierBodies.Count; i++)
            {
                _barrierBodies[i].CollisionCategories = Category.Cat10;
                _barrierBodies[i].CollidesWith        = Category.Cat5; /* should only collide with grabbables*/
                _barrierBodies[i].UserData            = "BARRIER";
                _barrierBodies[i].OnCollision        += OnCollision;
            }
            Deactivated();
        }
Exemple #5
0
        private void AddCircle(int radius, int numSides)
        {
            Vertices verts = PolygonTools.CreateCircle(radius, numSides);

            _polygons.Add(verts);
        }
        public WebOfGoo(World world, Vector2 position, float radius, int rings, int sides)
        {
            _ringBodys  = new List <List <Body> >(rings);
            _ringJoints = new List <DistanceJoint>();

            for (int i = 1; i < rings; i++)
            {
                Vertices vertices = PolygonTools.CreateCircle(i * 2.9f, sides);
                vertices.Translate(ref position);
                List <Body> bodies = new List <Body>(sides);

                //Create the first goo
                Body previous = BodyFactory.CreateCircle(world, radius, 0.2f, vertices[0]);
                previous.BodyType = BodyType.Dynamic;

                bodies.Add(previous);

                //Connect the first goo to the next
                for (int j = 1; j < vertices.Count; j++)
                {
                    Body current = BodyFactory.CreateCircle(world, radius, 0.2f, vertices[j]);
                    current.BodyType = BodyType.Dynamic;

                    DistanceJoint joint = new DistanceJoint(previous, current, Vector2.Zero, Vector2.Zero);
                    joint.Frequency    = 4.0f;
                    joint.DampingRatio = 0.5f;
                    joint.Breakpoint   = Breakpoint;
                    world.AddJoint(joint);
                    _ringJoints.Add(joint);

                    previous = current;
                    bodies.Add(current);
                }

                //Connect the first and the last goo
                DistanceJoint jointClose = new DistanceJoint(bodies[0], bodies[bodies.Count - 1], Vector2.Zero, Vector2.Zero);
                jointClose.Frequency    = 4.0f;
                jointClose.DampingRatio = 0.5f;
                jointClose.Breakpoint   = Breakpoint;
                world.AddJoint(jointClose);
                _ringJoints.Add(jointClose);

                _ringBodys.Add(bodies);
            }

            //Create an outer ring
            Vertices frame = PolygonTools.CreateCircle(rings * 2.9f - 0.9f, sides);

            frame.Translate(ref position);

            Body anchor = new Body(world, position);

            anchor.BodyType = BodyType.Static;

            //Attach the outer ring to the anchor
            for (int i = 0; i < _ringBodys[rings - 2].Count; i++)
            {
                DistanceJoint joint = new DistanceJoint(anchor, _ringBodys[rings - 2][i], frame[i], _ringBodys[rings - 2][i].Position, true);
                joint.Frequency    = 8.0f;
                joint.DampingRatio = 0.5f;
                joint.Breakpoint   = Breakpoint;
                world.AddJoint(joint);
                _ringJoints.Add(joint);
            }

            //Interconnect the rings
            for (int i = 1; i < _ringBodys.Count; i++)
            {
                for (int j = 0; j < sides; j++)
                {
                    DistanceJoint joint = new DistanceJoint(_ringBodys[i - 1][j], _ringBodys[i][j], Vector2.Zero, Vector2.Zero);
                    joint.Frequency    = 4.0f;
                    joint.DampingRatio = 0.5f;
                    joint.Breakpoint   = Breakpoint;
                    world.AddJoint(joint);
                    _ringJoints.Add(joint);
                }
            }

            _link = new Sprite(ContentWrapper.GetTexture("Link"));
            _goo  = new Sprite(ContentWrapper.GetTexture("Goo"));
        }
        public Spiderweb(World world, Body ground, Vector2 position, float radius, int rings, int sides)
        {
            _world  = world;
            _radius = radius;

            const float breakpoint = 100f;


            List <List <Body> > ringBodys = new List <List <Body> >(rings);

            for (int i = 1; i < rings; ++i)
            {
                Vertices    vertices = PolygonTools.CreateCircle(i * 2.9f, sides);
                List <Body> bodies   = new List <Body>(sides);

                //Create the first goo
                Body prev = world.CreateCircle(radius, 0.2f, vertices[0]);
                prev.FixedRotation = true;
                prev.Position     += position;
                prev.BodyType      = BodyType.Dynamic;

                bodies.Add(prev);

                //Connect the first goo to the next
                for (int j = 1; j < vertices.Count; ++j)
                {
                    Body bod = world.CreateCircle(radius, 0.2f, vertices[j]);
                    bod.FixedRotation = true;
                    bod.BodyType      = BodyType.Dynamic;
                    bod.Position     += position;

                    DistanceJoint dj = JointFactory.CreateDistanceJoint(world, prev, bod, Vector2.Zero, Vector2.Zero);
                    dj.Frequency    = 4.0f;
                    dj.DampingRatio = 0.5f;
                    dj.Breakpoint   = breakpoint;

                    prev = bod;
                    bodies.Add(bod);
                }

                //Connect the first and the last goo
                DistanceJoint djEnd = JointFactory.CreateDistanceJoint(world, bodies[0], bodies[bodies.Count - 1], Vector2.Zero, Vector2.Zero);
                djEnd.Frequency    = 4.0f;
                djEnd.DampingRatio = 0.5f;
                djEnd.Breakpoint   = breakpoint;

                ringBodys.Add(bodies);
            }

            //Create an outer ring
            Vertices lastRing = PolygonTools.CreateCircle(rings * 2.9f, sides);

            lastRing.Translate(ref position);

            List <Body> lastRingBodies = ringBodys[ringBodys.Count - 1];

            //Fix each of the body of the outer ring
            for (int j = 0; j < lastRingBodies.Count; ++j)
            {
                lastRingBodies[j].BodyType = BodyType.Static;
            }

            //Interconnect the rings
            for (int i = 1; i < ringBodys.Count; i++)
            {
                List <Body> prev    = ringBodys[i - 1];
                List <Body> current = ringBodys[i];

                for (int j = 0; j < prev.Count; j++)
                {
                    Body prevFixture    = prev[j];
                    Body currentFixture = current[j];

                    DistanceJoint dj = JointFactory.CreateDistanceJoint(world, prevFixture, currentFixture, Vector2.Zero, Vector2.Zero);
                    dj.Frequency    = 4.0f;
                    dj.DampingRatio = 0.5f;
                }
            }
        }
Exemple #8
0
        protected override void SetupPhysics(World world)
        {
#if EDITOR
#else
            this._pathBodies = new List <Body>();
            float   width    = ConvertUnits.ToSimUnits(this._texture.Width * 0.5f);
            float   height   = ConvertUnits.ToSimUnits(this._texture.Height * 0.5f);
            Vector2 startPos = ConvertUnits.ToSimUnits(this._position);
            Vector2 endPos   = ConvertUnits.ToSimUnits(this._endPosition);

            Path _ropePath = new Path();
            _ropePath.Add(startPos);
            _ropePath.Add(endPos);

            PolygonShape rotationPointShape = new PolygonShape(PolygonTools.CreateCircle(height, 8), 25);
            PolygonShape shape       = new PolygonShape(PolygonTools.CreateRectangle(width, height), ConvertUnits.ToSimUnits(1.0f));
            PolygonShape sensorShape = new PolygonShape(PolygonTools.CreateCircle(height * 1.5f, 6), 1.0f);

            List <Shape> shapes = new List <Shape>(2);
            shapes.Add(new PolygonShape(PolygonTools.CreateRectangle(0.5f, 0.5f, new Vector2(-0.1f, 0f), 0f), 1f));
            shapes.Add(new CircleShape(0.5f, 1f));

            _pathBodies = PathManager.EvenlyDistributeShapesAlongPath(world, _ropePath, shapes,
                                                                      BodyType.Dynamic, _chainCount);

            JointFactory.CreateFixedRevoluteJoint(world, _pathBodies[0], Vector2.Zero, startPos);

            PathManager.AttachBodiesWithRevoluteJoint(world, _pathBodies, new Vector2(0f, -0.5f), new Vector2(0f, 0.5f),
                                                      false, true);

            for (int i = 1; i < _pathBodies.Count; i++)
            {
                _pathBodies[i].FixtureList[0].CollidesWith = Category.All & ~Category.Cat10 & ~Category.Cat12;
                _pathBodies[i].FixtureList[1].CollidesWith = Category.All & ~Category.Cat10 & ~Category.Cat12;

                Fixture fix = FixtureFactory.AttachCircle(height * 2, 0.0f, _pathBodies[i]);
                fix.IsSensor = true;

                fix.OnCollision  += Body_OnCollision;
                fix.OnSeparation += Body_OnSeparation;
            }

            //Body prevBody = new Body(world); ;
            //for (int i = 0; i < _chainCount; ++i)
            //{
            //    Body body = new Body(world);
            //    body.BodyType = BodyType.Dynamic;
            //    body.Position = startPos + new Vector2(0, height * i);

            //    if (i == 0)
            //    {
            //        Fixture fixture = body.CreateFixture(rotationPointShape);
            //        fixture.Friction = 0.2f;
            //        body.AngularDamping = 0.4f;

            //        FixedRevoluteJoint fixedJoint = JointFactory.CreateFixedRevoluteJoint(world, body, Vector2.Zero, startPos);
            //    }
            //    else
            //    {
            //        Fixture fixture = body.CreateFixture(shape);
            //        fixture.Friction = 0.2f;

            //        Fixture sensorFix = FixtureFactory.AttachCircle(height * 2, 0.0f, body);
            //        sensorFix.IsSensor = true;

            //        fixture.CollidesWith = Category.All & ~Category.Cat10 & ~Category.Cat12;

            //        RopeJoint rj = new RopeJoint(prevBody, body, new Vector2(0.0f, height), new Vector2(0.0f, -height * 0.5f));

            //        rj.CollideConnected = false;
            //        world.AddJoint(rj);

            //        body.FixtureList[1].Body.OnCollision += Body_OnCollision;
            //        body.FixtureList[1].Body.OnSeparation += Body_OnSeparation;
            //    }

            //    prevBody = body;
            //    _pathBodies.Add(body);
            //}
#endif
        }
Exemple #9
0
    void Start()
    {
        // Create Vector2 vertices
        Vector2[] vertices2D = null;

        switch (tipo)
        {
        case Tipo.CAPSULE:
            vertices2D = USVG.PolygonTools.CreateCapsule(Height, Radius, Edges);
            break;

        case Tipo.CIRCLE:
            vertices2D = PolygonTools.CreateCircle(Radius, Edges);
            break;

        case Tipo.ELIPSE:
            vertices2D = PolygonTools.CreateEllipse(Radius, yRadius, Edges);
            break;

        case Tipo.GEAR:
            vertices2D = PolygonTools.CreateGear(Radius, NumberOfTheeth, TipPercentage, ToothHeight);
            break;

        case Tipo.ROUNDED_RECTANGLE:
            vertices2D = PolygonTools.CreateRoundedRectangle(Height, Width, Radius, yRadius, Edges);
            break;

        default:
        case Tipo.RECTANGLE:
            vertices2D = PolygonTools.CreateRectangle(Height, Width);
            break;
        }


        // Use the triangulator to get indices for creating triangles
        Triangulator tr = new Triangulator(vertices2D);

        int[] indices = tr.Triangulate();

        // Create the Vector3 vertices
        Vector3[] vertices = new Vector3[vertices2D.Length];
        for (int i = 0; i < vertices.Length; i++)
        {
            vertices[i] = new Vector3(vertices2D[i].x, vertices2D[i].y, 0);
        }

        // Create the mesh
        Mesh msh = new Mesh();

        msh.vertices  = vertices;
        msh.triangles = indices;
        msh.RecalculateNormals();
        msh.RecalculateBounds();

        // Set up game object with mesh;
        gameObject.AddComponent(typeof(MeshRenderer));
        MeshFilter filter = gameObject.GetComponent <MeshFilter>();

        if (filter == null)
        {
            filter = gameObject.AddComponent(typeof(MeshFilter)) as MeshFilter;
        }

        filter.mesh = msh;
    }
        private void TextureFromDictionary(Dictionary <string, object> shapeParam, out Texture2D texture, out Vertices shapeVertices)
        {
            shapeVertices = null;
            texture       = null;
            ObjectType objectType = (ObjectType)shapeParam[ShapeParametersKeys.ObjectType];

            switch (objectType)
            {
            case ObjectType.Arc:
                shapeVertices = PolygonTools.CreatePreTransformedArt(MathHelper.ToRadians((float)shapeParam[ShapeParametersKeys.ArcDegrees]), (int)shapeParam[ShapeParametersKeys.ArcSides], (float)shapeParam[ShapeParametersKeys.ArcRadius]);
                texture       = ContentService.GetContentService().AssetCreator.TextureFromVertices(shapeVertices, (string)shapeParam[ShapeParametersKeys.Material], (Color)shapeParam[ShapeParametersKeys.Color], (float)shapeParam[ShapeParametersKeys.MaterialScale]);

                //shapeVertices.GetCollisionBox().;
                //Vector2 arcOffset = Vector2.One;
                //shapeVertices.Translate(ref arcOffset);
                break;

            case ObjectType.Capsule:
                shapeVertices = PolygonTools.CreateCapsule((float)shapeParam[ShapeParametersKeys.CapsuleHeight], (float)shapeParam[ShapeParametersKeys.CapsuleBottomRadius], (int)shapeParam[ShapeParametersKeys.CapsuleBottomEdges], (float)shapeParam[ShapeParametersKeys.CapsuleTopRadius], (int)shapeParam[ShapeParametersKeys.CapsuleTopEdges]);
                texture       = ContentService.GetContentService().AssetCreator.TextureFromVertices(shapeVertices, (string)shapeParam[ShapeParametersKeys.Material], (Color)shapeParam[ShapeParametersKeys.Color], (float)shapeParam[ShapeParametersKeys.MaterialScale]);
                break;

            case ObjectType.Gear:
                shapeVertices = PolygonTools.CreateGear((float)shapeParam[ShapeParametersKeys.GearTipPercentage], (int)shapeParam[ShapeParametersKeys.GearNumberOfTeeth], (float)shapeParam[ShapeParametersKeys.GearTipPercentage], (float)shapeParam[ShapeParametersKeys.GearToothHeigt]);
                texture       = ContentService.GetContentService().AssetCreator.TextureFromVertices(shapeVertices, (string)shapeParam[ShapeParametersKeys.Material], (Color)shapeParam[ShapeParametersKeys.Color], (float)shapeParam[ShapeParametersKeys.MaterialScale]);
                break;

            case ObjectType.Rectangle:
                shapeVertices = PolygonTools.CreateRectangle((float)shapeParam[ShapeParametersKeys.RectangleWidth], (float)shapeParam[ShapeParametersKeys.RectangleHeight]);
                texture       = ContentService.GetContentService().AssetCreator.TextureFromVertices(shapeVertices, (string)shapeParam[ShapeParametersKeys.Material], (Color)shapeParam[ShapeParametersKeys.Color], (float)shapeParam[ShapeParametersKeys.MaterialScale]);
                break;

            case ObjectType.RoundedRectangle:
                shapeVertices = PolygonTools.CreateRoundedRectangle((float)shapeParam[ShapeParametersKeys.RoundedRectangleWidth], (float)shapeParam[ShapeParametersKeys.RoundedRectangleHeight], (float)shapeParam[ShapeParametersKeys.RoundedRectangleXRadius], (float)shapeParam[ShapeParametersKeys.RoundedRectangleYRadius], (int)shapeParam[ShapeParametersKeys.RoundedRectangleSegments]);
                texture       = ContentService.GetContentService().AssetCreator.TextureFromVertices(shapeVertices, (string)shapeParam[ShapeParametersKeys.Material], (Color)shapeParam[ShapeParametersKeys.Color], (float)shapeParam[ShapeParametersKeys.MaterialScale]);
                break;

            case ObjectType.Ellipse:
                shapeVertices = PolygonTools.CreateEllipse((float)shapeParam[ShapeParametersKeys.EllipseXRadius], (float)shapeParam[ShapeParametersKeys.EllipseYRadius], (int)shapeParam[ShapeParametersKeys.EllipseNumberOfEdges]);
                texture       = ContentService.GetContentService().AssetCreator.EllipseTexture((float)shapeParam[ShapeParametersKeys.EllipseXRadius], (float)shapeParam[ShapeParametersKeys.EllipseYRadius], (string)shapeParam[ShapeParametersKeys.Material], (Color)shapeParam[ShapeParametersKeys.Color], (float)shapeParam[ShapeParametersKeys.MaterialScale]);
                break;

            case ObjectType.Circle:
                shapeVertices = PolygonTools.CreateCircle((float)shapeParam[ShapeParametersKeys.CircleRadius], (int)shapeParam[ShapeParametersKeys.CircleSegments]);
                texture       = ContentService.GetContentService().AssetCreator.CircleTexture((float)shapeParam[ShapeParametersKeys.CircleRadius], (string)shapeParam[ShapeParametersKeys.Material], (Color)shapeParam[ShapeParametersKeys.Color], (float)shapeParam[ShapeParametersKeys.MaterialScale]);
                break;

            case ObjectType.CustomShape:
                if ((bool)shapeParam[ShapeParametersKeys.CustomObjectUseOriginalTexture])
                {
                    ContentService.GetContentService().AssetCreator.ShapeFromTexture((string)shapeParam[ShapeParametersKeys.CustomObjectShape], (float)shapeParam[ShapeParametersKeys.CustomObjectScale], (Color)shapeParam[ShapeParametersKeys.Color], out texture, out shapeVertices);
                }
                else
                {
                    ContentService.GetContentService().AssetCreator.ShapeFromTexture((string)shapeParam[ShapeParametersKeys.CustomObjectShape], (float)shapeParam[ShapeParametersKeys.CustomObjectScale], (string)shapeParam[ShapeParametersKeys.Material], (Color)shapeParam[ShapeParametersKeys.Color], (float)shapeParam[ShapeParametersKeys.MaterialScale], out texture, out shapeVertices);
                }
                break;

            default:
                throw new Exception("Unknown Shape");
            }
        }