Java Code Examples for com.jme3.bullet.objects.PhysicsRigidBody#setAngularFactor()

The following examples show how to use com.jme3.bullet.objects.PhysicsRigidBody#setAngularFactor() . You can vote up the ones you like or vote down the ones you don't like, and go to the original project or source file by following the links above each example. You may check out the related API usage on the sidebar.
Example 1
Source File: BetterCharacterControl.java    From jmonkeyengine with BSD 3-Clause "New" or "Revised" License 5 votes vote down vote up
/**
 * De-serialize this control, for example when loading from a J3O file.
 *
 * @param im importer (not null)
 * @throws IOException from importer
 */
@Override
public void read(JmeImporter im) throws IOException {
    super.read(im);
    InputCapsule in = im.getCapsule(this);
    this.radius = in.readFloat("radius", 1);
    this.height = in.readFloat("height", 2);
    this.mass = in.readFloat("mass", 80);
    this.physicsDamping = in.readFloat("physicsDamping", 0.9f);
    this.jumpForce.set((Vector3f) in.readSavable("jumpForce", new Vector3f(0, mass * 5, 0)));
    rigidBody = new PhysicsRigidBody(getShape(), mass);
    jumpForce.set(new Vector3f(0, mass * 5, 0));
    rigidBody.setAngularFactor(0);
}
 
Example 2
Source File: BetterCharacterControl.java    From jmonkeyengine with BSD 3-Clause "New" or "Revised" License 3 votes vote down vote up
/**
 * Instantiate an enabled control with the specified properties.
 * <p>
 * The final height when ducking must be larger than 2x radius. The
 * jumpForce will be set to an upward force of 5x mass.
 *
 * @param radius the radius of the character's collision shape (&gt;0)
 * @param height the height of the character's collision shape
 * (&gt;2*radius)
 * @param mass the character's mass (&ge;0)
 */
public BetterCharacterControl(float radius, float height, float mass) {
    this.radius = radius;
    this.height = height;
    this.mass = mass;
    rigidBody = new PhysicsRigidBody(getShape(), mass);
    jumpForce = new Vector3f(0, mass * 5, 0);
    rigidBody.setAngularFactor(0);
}