Skip to content

Define shape for physics body  #57

@lexengineer

Description

@lexengineer

Hello everyone!

I am using react-native-game-engine and matter-js for my application and I want to render a shape of my SVG element for example. On the react-native side it works great because I just show it inside my renderer component with react-native-svg. But the issue is that I also need a matter-js physic body to have the same shape in order for physics to work correctly.

I tried using Matter.Bodies.fromVertices method, but have a lot of issues during SVG conversion, so that was unsuccessful. I also found this guide https://www.codeandweb.com/physicseditor/tutorials/how-to-create-physics-shapes-for-phaser-3-and-matterjs, but it won't work because it is using Matter.Render and I am using react-native-game-engine instead.

So the question is how to render custom shapes and what is the preferable way to create them? Maybe tree-js will fit better for that?

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions