Jump to content
This forum will be closing down. Please move to the respective dedicated project forums.

Rendering geometry with matter


Trance
 Share

Recommended Posts

Does anyone know how I can get the Matter physics engine to render its geometry when running within Phaser? I.e. when I'm not assigning a sprite to a physics body, but I want the geometry of the objects I've created to be rendered as lines instead.

If I set "debug" to true on the Matter config, I can see purple lines being rendered by the debugger. But if I set debug to false, I no longer see anything rendered.

I've found there are a bunch of properties on the Matter "Body" object like StrokeStyle, LineWidth and FillStyle (described here) which seem designed for this purpose. However, I can't see equivalents for those in the Phaser documentation, and when I set the properties on the Matter body directly they seem to have no effect. Am I missing some simple piece of config or setup that I need to do, or have I stumbled across a bug or unsupported feature?

Link to comment
Share on other sites

Damn, that's bad news. There's no way to turn it on then?

Failing that, I could get away with just using the debug drawing, but even that seems broken - it works the first time I load a scene, but on subsequent occasions it doesn't draw anything. :(

Link to comment
Share on other sites

Matter.Render is not included because it's a huge file (it adds 50KB to the source), doesn't work in WebGL and, in the authors own words, was created for debugging purposes.

If you want to use it then you can add the file to your own build and call it the way they do in the Matter examples, just passing in `this.matter.world` as the 'engine' property in the Render.create config object.

Link to comment
Share on other sites

 Share

  • Recently Browsing   0 members

    • No registered users viewing this page.
×
×
  • Create New...