question-mark
Stuck on an issue?

Lightrun Answers was designed to reduce the constant googling that comes with debugging 3rd party libraries. It collects links to all the places you might be looking at while hunting down a tough bug.

And, if you’re still stuck at the end, we’re happy to hop on a call to see how we can help out.

Not able to create concave object as it is achieved in the demo

See original GitHub issue

I am trying to make concave object but alas I recieve:

matter.min.js:55 Uncaught TypeError: c.makeCCW is not a function
    at Object.o.fromVertices (matter.min.js:55)
    at main.js:558
    at Object.o.stack (matter.min.js:57)

My implementation is as follows:

 var chevron = Matter.Vertices.fromPath('100 0 75 50 100 100 25 100 0 50 25 0');
            var stack = Matter.Composites.stack(50, 50, 6, 4, 10, 10, function(x, y) {
                var color = '#556270';
                return Bodies.fromVertices(x, y, chevron, {
                    render: {
                        fillStyle: color,
                        strokeStyle: color,
                        lineWidth: 1
                    }
                }, true);
            });

var add = function(body) {
    World.add(engine.world, [body]);
}
add(stack);

I thank you for your help it is very nice engine! but I digress…

Best,

Issue Analytics

  • State:closed
  • Created 6 years ago
  • Comments:5 (2 by maintainers)

github_iconTop GitHub Comments

1reaction
liabrucommented, Aug 22, 2018

That is a list of vertices in the form x y x y x y ..., the origin will be calculated as the centre of mass of that shape.

0reactions
Eman2022commented, Aug 9, 2018

“Matter.Vertices.fromPath(‘100 0 75 50 100 100 25 100 0 50 25 0’);”

DOES anyone understand how this works? The first 100 0 is supposed to be the origin? Say if I wanted to just make a triangle, how do I plot it out? The last two 25 0 must be something important too?

Read more comments on GitHub >

github_iconTop Results From Across the Web

Generate compound colliders with one click! [RELEASED]
In Unity mesh to mesh collisions only work if at least one of the meshes is convex. The Concave Collider helps overcoming this...
Read more >
Concave Mirror Demo - YouTube
This is a demonstration of the images formed by a concave mirror as a function of the distance of ... Your browser can't...
Read more >
Concave mirror real image demonstration /// Homemade ...
Your browser can't play this video. Learn more. Switch camera.
Read more >
Understanding Physics: Collision Shapes, Mesh vs Hull ...
Your browser can't play this video. ... Understanding Physics: Collision Shapes, Mesh vs Hull, Concave vs Convex - for Unity and Buildbox.
Read more >
Ray Diagrams - Concave Mirrors - The Physics Classroom
A ray diagram shows the path of light from an object to mirror to an eye. ... While plane mirrors always produce virtual...
Read more >

github_iconTop Related Medium Post

No results found

github_iconTop Related StackOverflow Question

No results found

github_iconTroubleshoot Live Code

Lightrun enables developers to add logs, metrics and snapshots to live code - no restarts or redeploys required.
Start Free

github_iconTop Related Reddit Thread

No results found

github_iconTop Related Hackernoon Post

No results found

github_iconTop Related Tweet

No results found

github_iconTop Related Dev.to Post

No results found

github_iconTop Related Hashnode Post

No results found