Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

concave body fixed texture #133

Closed
ezshine opened this issue Aug 6, 2015 · 3 comments
Closed

concave body fixed texture #133

ezshine opened this issue Aug 6, 2015 · 3 comments

Comments

@ezshine
Copy link

ezshine commented Aug 6, 2015

Hello , I'm create a concave body like Tetris "L"

var tetris=Vertices.fromPath('0 60 40 60 40 40 20 40 20 0 0 0');
var compoundBodyB = Matter.Bodies.fromVertices(0, 0, tetris,{render:{sprite:{texture:"images/test.png"}}});

the texture has some problem.

and the position it's not at (0,0) , how can i fixed these issue?

thanks so much~

@ezshine
Copy link
Author

ezshine commented Aug 6, 2015

the texture size is width:40px height:60px

@liabru
Copy link
Owner

liabru commented Dec 5, 2015

I think the problem here might be the same as in #153, so please now refer to that thread, thanks.

@liabru liabru closed this as completed Dec 5, 2015
@Nilbristi
Copy link

Nilbristi commented Jul 11, 2018

I am facing texture repetition issue while using fromVertices. Any solution? Check the attached screenshot.
repeat

var customTrey = Vertices.fromPath('0 0 0 20 152 20 152 0 150 0 150 18 2 18 2 0 0 0');
 var trey = Bodies.fromVertices(1080, 385, customTrey, getOptions('images/trey.png', true, false), true, 0.01, 30);

function getOptions(sprite = '', static = false, sensor = false) {
    var options = {
        isSensor: sensor,
        isStatic: static,
        density: 0.1,
        frictionAir: 0.001,
        restitution: 0,
        friction: 0,
        // id: 420,
        render: {
            fillStyle: 'none',
            sprite: {
                texture: sprite,
                xScale: 1,
                yScale: 1
            }
        }
    }
    return options;
};

Here is the sprite image:
trey

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

3 participants