本文整理了Java中org.jbox2d.dynamics.Body.setType()
方法的一些代码示例,展示了Body.setType()
的具体用法。这些代码示例主要来源于Github
/Stackoverflow
/Maven
等平台,是从一些精选项目中提取出来的代码,具有较强的参考意义,能在一定程度帮忙到你。Body.setType()
方法的具体详情如下:
包路径:org.jbox2d.dynamics.Body
类名称:Body
方法名:setType
[英]Set the type of this body. This may alter the mass and velocity.
[中]设置此实体的类型。这可能会改变质量和速度。
代码示例来源:origin: libgdx/libgdx
/** Set the type of this body. This may alter the mass and velocity. */
public void setType (BodyType type) {
org.jbox2d.dynamics.BodyType t = org.jbox2d.dynamics.BodyType.DYNAMIC;
if (type == BodyType.DynamicBody) t = org.jbox2d.dynamics.BodyType.DYNAMIC;
if (type == BodyType.KinematicBody) t = org.jbox2d.dynamics.BodyType.KINEMATIC;
if (type == BodyType.StaticBody) t = org.jbox2d.dynamics.BodyType.STATIC;
body.setType(t);
}
代码示例来源:origin: jbox2d/jbox2d
@Override
public void keyPressed(char argKeyChar, int argKeyCode) {
switch (argKeyChar) {
case 'd':
m_platform.setType(BodyType.DYNAMIC);
break;
case 's':
m_platform.setType(BodyType.STATIC);
break;
case 'k':
m_platform.setType(BodyType.KINEMATIC);
m_platform.setLinearVelocity(new Vec2(-m_speed, 0.0f));
m_platform.setAngularVelocity(0.0f);
break;
}
}
代码示例来源:origin: org.jbox2d/jbox2d-testbed
@Override
public void keyPressed(char argKeyChar, int argKeyCode) {
switch (argKeyChar) {
case 'd':
m_platform.setType(BodyType.DYNAMIC);
break;
case 's':
m_platform.setType(BodyType.STATIC);
break;
case 'k':
m_platform.setType(BodyType.KINEMATIC);
m_platform.setLinearVelocity(new Vec2(-m_speed, 0.0f));
m_platform.setAngularVelocity(0.0f);
break;
}
}
内容来源于网络,如有侵权,请联系作者删除!