Empresas
Empregos
  • Sobre nós
  • Soluções
    • Publicação de vagas
      Publique sua vaga e receba candidatos qualificados em 48h.
    • Avaliações de candidatos
      Mais de 500 testes técnicos e psicológicos, mais anti-fraude.
    • Headhunting
      Busca executiva personalizada do início ao fim.
    • Folha de Pagamento + EOR
      Dispersão de folha e EOR em mais de 15 países da LATAM.
  • Preços
  • Empregos

0

146
Visualizações
How to chamfer only two corners (rectangle) in Matter.js?

I have a rectangular matter.js body and I only want to chamfer the top-left and top-right corners, but not the bottom. How will I do that?

Bodies.rectangle(x, y, w, h, { chamfer: 5 }) // chamfers all corners :(

about 4 years ago · Juan Pablo Isaza
1 Respostas
Responde à pergunta

0

The method Bodies.rectangle calls Vertices.chamfer as found on these lines of code, and it expects that the chamfer property be an object. However, if you pass a single number it will apply the same chamfer number to all of the vertices as seen here.

Reading over the documentation, we found that:

The radius parameter is a single number or an array to specify the radius for each vertex.

For a rectangle, the vertices are clockwise starting from the top left. After all, to chamfer only the top left and top right corners, the code should be:

Bodies.rectangle(x, y, w, h, { 
  chamfer: {
    radius: [5,5,0,0]
  }
})
about 4 years ago · Juan Pablo Isaza Relatório
Responde à pergunta
Encontrar trabalhos remotos

Descubra a nova forma de encontrar um emprego!

melhores empregos
Principais categorias de trabalho
Empresas
Postar vaga Preços Comercial
Jurídico
Termos e Condições Política de privacidade
© 2026 PeakU Inc. All Rights Reserved.
Andres GPT
Recomende algumas ofertas para mim
Preciso de ajuda