Remove borders of circles, rectangles etc.

Apr 7, 2011 at 11:41 AM

hi there,

I've been working on a schoolproject using faseer, and bump into a small problem. For some reason i cant get rid of the borders around the shapes i make.

Does someone have a solution for it?

Thanks in advantage

The code i used:

           DebugMaterial material = new DebugMaterial(MaterialType.Face) { Color = Color.PeachPuff, Scale = 4f };
            Body body = BodyFactory.CreateBody(world, startPos);

            Fixture[] fixture = new Fixture[1];

            fixture[0] = FixtureFactory.CreateRectangle(5f, 2.5f, 1, new Vector2(), body,material);
            fixture[0].Body.BodyType = BodyType.Dynamic;
            fixture[0].Body.LinearVelocity = curForce;
            fixture[0].Restitution = 0f;
            fixture[0].Friction = 5f;

            this.setFixtures(fixture);

Coordinator
Apr 8, 2011 at 10:07 PM

Are they visual borders or invisible borders?

Apr 9, 2011 at 9:08 AM
Edited Apr 9, 2011 at 9:09 AM

Here's the printscreen, te purple hat you see is actually a picture in a rectangle. As you see it doesn't look that nice because (1) Its not transparent (2)There's a big fat black border around the shape.

For point 1, i can find a work around, although if there is a simple fix, it would be apreciated.

For point 2, i would really like a solution.


Did this answer your question?

Greetings and thanks in advantage

Some code:

 

            DebugMaterial material = new DebugMaterial(MaterialType.Oyo) { Color = Color.PeachPuff, Scale = 5f };
            DebugMaterial hatMaterial = new DebugMaterial(MaterialType.OyoHat) { Scale = 5f, CenterOnBody = true};
            Body body = BodyFactory.CreateBody(world, startPos);
            Body hatBody = BodyFactory.CreateBody(world, startPos);

            Fixture[] fixture = new Fixture[1];
            fixture[0] = FixtureFactory.CreateCircle(2, 1, body, material);
            fixture[0].Body.BodyType = BodyType.Dynamic;
            fixture[0].Body.LinearVelocity = curForce;
            fixture[0].Restitution = 0.2f;
            fixture[0].Friction = 1f;

            this.setFixtures(fixture);

            Fixture[] hatFixture = new Fixture[1];
            hatFixture[0] = FixtureFactory.CreateRectangle(5f, 5f, 0.01f, new Vector2(), hatBody, hatMaterial);
            hatFixture[0].Body.BodyType = BodyType.Dynamic;
            hatFixture[0].Body.IgnoreGravity = true;
            hatFixture[0].CollisionFilter.CollisionCategories = Category.None;
            hatFixture[0].CollisionFilter.CollidesWith = Category.None;

            this.setHatFixtures(hatFixture);

            WeldJoint oyoJoint = new WeldJoint(fixture[0].Body, hatFixture[0].Body, new Vector2(0, 0), new Vector2(0, 0));
            this.world.AddJoint(oyoJoint);
Apr 9, 2011 at 6:49 PM
Edited Apr 9, 2011 at 6:50 PM

it seems like the image is not working.

i hope this will do the trick:

http://img197.imageshack.us/i/visibleborders.png/ (imagehack)

Apr 18, 2011 at 9:24 PM

Can someone please help me with this issue?

Coordinator
Apr 19, 2011 at 12:26 AM

It is a visual problem and we are a physics engine. I guess you are using the drawing code from the samples? If that is not working for you, you should try and create your own drawing code.

If you use XNA, try reading up on the Spritebatch and its alpha (transparency) settings.