如何在Matter.js中仅倒角两个角(矩形)?
我有一个矩形的物质。js身体,我只想倒出左上角和右上角,而不是底部。我该怎么做?
bodies.Rectangle(X,Y,W,H,{Chamfer:5})// Chamfers All Corners :(
>
如果你对这篇内容有疑问,欢迎到本站社区发帖提问 参与讨论,获取更多帮助,或者扫码二维码加入 Web 技术交流群。

绑定邮箱获取回复消息
由于您还没有绑定你的真实邮箱,如果其他用户或者作者回复了您的评论,将不能在第一时间通知您!
发布评论
评论(1)
方法
bodies.Rectangle
调用vertices.chamfer
,如这些倒角属性是对象。但是,如果您通过一个数字,它将将相同的倒角号应用于与在这里。通过文档,我们发现::
对于矩形,顶点是从左上方开始的。毕竟,要倒角左上角和右上角,代码应为:
The method
Bodies.rectangle
callsVertices.chamfer
as found on these lines of code, and it expects that thechamfer
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:
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: