Business
Jobs
  • About Us
  • Solutions
    • Job Postings
      Post your job and receive qualified candidates in 48h.
    • Candidate Assessments
      500+ technical and psychological tests, plus anti-fraud.
    • Headhunting
      Tailor-made executive search from start to finish.
    • Payroll + EOR
      Payroll dispersal and EOR across 15+ LATAM countries.
  • Pricing
  • Jobs

0

139
Views
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 answers
Answer question

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 Report
Answer question
Find remote jobs

Discover the new way to find a job!

Top jobs
Top job categories
Business
Post vacancy Pricing Sales
Legal
Terms and conditions Privacy policy
© 2026 PeakU Inc. All Rights Reserved.
Andres GPT
Show me some job opportunities
There's an error!