Empresas
Empleos
  • Sobre nosotros
  • Soluciones
    • Publicación de vacantes
      Publica tu vacante y recibe candidatos calificados en 48h.
    • Evaluación de candidatos
      500+ pruebas técnicas y psicológicas, más anti-fraude.
    • Headhunting
      Búsqueda ejecutiva a la medida de principio a fin.
    • Nómina + EOR
      Dispersión de nómina y EOR en más de 15 países de LATAM.
  • Precios
  • Empleos

0

147
Vistas
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 Respuestas
Responde la pregunta

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 Denunciar
Responde la pregunta
Encuentra empleos remotos

¡Descubre la nueva forma de encontrar empleo!

Top de empleos
Top categorías de empleo
Empresas
Publicar vacante Precios Comercial
Legal
Términos y condiciones Política de privacidad
© 2026 PeakU Inc. All Rights Reserved.
Andres GPT
Recomiéndame algunas ofertas
Necesito ayuda