org.jbox2d.dynamics.Body.setMassData()方法的使用及代码示例

x33g5p2x  于2022-01-17 转载在 其他  
字(1.2k)|赞(0)|评价(0)|浏览(160)

本文整理了Java中org.jbox2d.dynamics.Body.setMassData()方法的一些代码示例,展示了Body.setMassData()的具体用法。这些代码示例主要来源于Github/Stackoverflow/Maven等平台,是从一些精选项目中提取出来的代码,具有较强的参考意义,能在一定程度帮忙到你。Body.setMassData()方法的具体详情如下:
包路径:org.jbox2d.dynamics.Body
类名称:Body
方法名:setMassData

Body.setMassData介绍

[英]Set the mass properties to override the mass properties of the fixtures. Note that this changes the center of mass position. Note that creating or destroying fixtures can also alter the mass. This function has no effect if the body isn't dynamic.
[中]设置体量特性以替代装置的体量特性。请注意,这会更改质心位置。请注意,创建或销毁装置也可以改变质量。如果主体不是动态的,则此功能无效。

代码示例

代码示例来源:origin: libgdx/libgdx

/** Set the mass properties to override the mass properties of the fixtures. Note that this changes the center of mass position.
 * Note that creating or destroying fixtures can also alter the mass. This function has no effect if the body isn't dynamic.
 * @param data the mass properties. */
public void setMassData (MassData data) {
  massData2.center.set(data.center.x, data.center.y);
  massData2.I = data.I;
  massData2.mass = data.mass;
  body.setMassData(massData2);
}

代码示例来源:origin: org.jbox2d/jbox2d-testbed

md.mass = massPerParticle;
md.I = 1.0f;
b.setMassData(md);
b.setSleepingAllowed(false);
liquid[i] = b;

代码示例来源:origin: org.jbox2d/jbox2d-testbed

md.mass = massPerParticle;
md.I = 1.0f;
b.setMassData(md);
b.setSleepingAllowed(false);
liquid[i] = b;

相关文章