/** 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); }
@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; } }
@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; } }