Java Code Examples for com.badlogic.gdx.physics.bullet.Bullet#obtainStaticNodeShape()

The following examples show how to use com.badlogic.gdx.physics.bullet.Bullet#obtainStaticNodeShape() . 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: GameObjectBlueprint.java    From GdxDemo3D with Apache License 2.0 5 votes vote down vote up
public GameObjectBlueprint(BlenderModel blenderModel, Model model) {
	this.model = model;
	setFromObject(blenderModel);
	this.mass = 0;
	ModelInstance modelInstance = new ModelInstance(model);
	GameModel.applyTransform(position, rotation, blenderModel.scale, modelInstance);

	this.shape = Bullet.obtainStaticNodeShape(modelInstance.nodes);
	this.shapeType = "static_node_shape_" + blenderModel.name;
	setCollisionFlags(this.mass);
}
 
Example 2
Source File: Builder.java    From Skyland with MIT License 5 votes vote down vote up
private static void buildCave(Matrix4 transform) {
    Model caveModel = Assets.get(CURR_MODEL, Model.class);
    if (WORLD.getConstructor("cave") == null) {
        for (Node n : caveModel.nodes) n.scale.set(.6f, .6f, .6f);
        btCollisionShape collisionShape = Bullet.obtainStaticNodeShape(caveModel.nodes);
        collisionShape.setLocalScaling(new Vector3(.6f, .6f, .6f));
        WORLD.addConstructor("cave", new BulletConstructor(caveModel, 0, collisionShape));
    }
    BulletEntity cave = WORLD.add("cave", transform);
    cave.body.setCollisionFlags(cave.body.getCollisionFlags()
            | btCollisionObject.CollisionFlags.CF_KINEMATIC_OBJECT);
    cave.body.setActivationState(Collision.DISABLE_DEACTIVATION);
    cave.body.userData = new BulletUserData("cave", cave);
}
 
Example 3
Source File: WorldGenerator.java    From Skyland with MIT License 5 votes vote down vote up
public static BulletWorld generateBaseWorld(boolean grid, boolean debug) {
    BulletWorld world = new BulletWorld(new Vector3(0, -9.81f, 0));
    Builder.init(world); //Sets the stuff so you can use Builder class

    if (debug)
        world.setDebugMode(btIDebugDraw.DebugDrawModes.DBG_DrawWireframe | btIDebugDraw.DebugDrawModes.DBG_DrawFeaturesText | btIDebugDraw.DebugDrawModes.DBG_DrawText | btIDebugDraw.DebugDrawModes.DBG_DrawContactPoints);
    if (grid)
        world.add(new BulletEntity(ModelGenerator.generateAxis(-10, 10, 1), null));

    btCollisionShape collisionShape = Bullet.obtainStaticNodeShape(Assets.get(Models.MODEL_ISLAND_PROTOTYPE, Model.class).nodes.first(), true);
    world.addConstructor("island", new BulletConstructor(Assets.get(Models.MODEL_ISLAND_PROTOTYPE, Model.class), 0, collisionShape));
    return world;
}