Example usage for com.badlogic.gdx.physics.box2d Fixture setDensity

List of usage examples for com.badlogic.gdx.physics.box2d Fixture setDensity

Introduction

In this page you can find the example usage for com.badlogic.gdx.physics.box2d Fixture setDensity.

Prototype

public void setDensity(float density) 

Source Link

Document

Set the density of this fixture.

Usage

From source file:edu.lehigh.cse.lol.Actor.java

License:Open Source License

/**
 * Adjust the default physics settings (density, elasticity, friction) for
 * this actor/*from w  ww.j a  v  a  2  s  . co  m*/
 *
 * @param density    New density of the actor
 * @param elasticity New elasticity of the actor
 * @param friction   New friction of the actor
 */
public Actor setPhysics(float density, float elasticity, float friction) {
    for (Fixture f : mBody.getFixtureList()) {
        f.setDensity(density);
        f.setRestitution(elasticity);
        f.setFriction(friction);
    }
    mBody.resetMassData();
    return this;
}

From source file:org.catrobat.catroid.physics.PhysicsObject.java

License:Open Source License

private void setDensity(float density) {
    if (density < MIN_DENSITY) {
        density = PhysicsObject.MIN_DENSITY;
    }//from w w  w .  ja  v a 2 s .c  o m
    fixtureDef.density = density;
    for (Fixture fixture : body.getFixtureList()) {
        fixture.setDensity(density);
    }
    body.resetMassData();
}