本文整理汇总了Java中com.badlogic.gdx.physics.bullet.Bullet.obtainStaticNodeShape方法的典型用法代码示例。如果您正苦于以下问题:Java Bullet.obtainStaticNodeShape方法的具体用法?Java Bullet.obtainStaticNodeShape怎么用?Java Bullet.obtainStaticNodeShape使用的例子?那么, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类com.badlogic.gdx.physics.bullet.Bullet
的用法示例。
在下文中一共展示了Bullet.obtainStaticNodeShape方法的8个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的Java代码示例。
示例1: reconstructBody
import com.badlogic.gdx.physics.bullet.Bullet; //导入方法依赖的package包/类
public void reconstructBody() {
if(body != null) {
body.dispose();
body = null;
}
btCollisionShape shape = Bullet.obtainStaticNodeShape(gameWorld.renderer().getRenderable(this).nodes);
if(shape != null)
gameWorld.renderer().buildBulletCollision(this, shape);
if(body != null) {
btMotionState state = body.getMotionState();
if(state instanceof DefaultMotionState) {
((DefaultMotionState)state).transform = this.transform;
}
}
switch(physicsState) {
case STATIC: setStatic(); break;
case KINEMATIC: setKinematic(); break;
case DYNAMIC: setDynamic(); break;
}
body.setWorldTransform(transform);
gameWorld.addInstance(this);
}
示例2: buildComplexCollisionMesh
import com.badlogic.gdx.physics.bullet.Bullet; //导入方法依赖的package包/类
public <T> void buildComplexCollisionMesh(WorldRenderer<T> renderer, T obj) {
ModelInstance inst = renderer.getRenderable(obj);
if(inst == null) return;
btCollisionShape shape = Bullet.obtainStaticNodeShape(inst.model.nodes);
if(shape != null)
renderer.buildBulletCollision(obj, shape);
}
示例3: buildCave
import com.badlogic.gdx.physics.bullet.Bullet; //导入方法依赖的package包/类
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);
}
示例4: generateBaseWorld
import com.badlogic.gdx.physics.bullet.Bullet; //导入方法依赖的package包/类
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;
}
示例5: GameObjectBlueprint
import com.badlogic.gdx.physics.bullet.Bullet; //导入方法依赖的package包/类
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);
}
示例6: initPhysics
import com.badlogic.gdx.physics.bullet.Bullet; //导入方法依赖的package包/类
/**
* Creates the collision objects of this planet part.
*/
private void initPhysics() {
for (int landscapeLayerIndex = 0; landscapeLayerIndex < planetConfig.layerConfigs.size(); landscapeLayerIndex++) {
String partName = LANDSCAPE_NODE_NAME + landscapeLayerIndex;
Node landscapeNode = model.getNode(partName);
CollisionTypes landscapeType = CollisionTypes.byName(planetConfig.layerConfigs.get(landscapeLayerIndex).collisionType);
if (areAllPartsValid(landscapeNode)) {
btCollisionShape collisionShape = Bullet.obtainStaticNodeShape(landscapeNode, false);
shapes.add(collisionShape);
if (landscapeType != CollisionTypes.WATER) {
float mass = 0;
float friction = 1;
PlanetConfig.LandscapeLayerConfig layerConfig = planetConfig.layerConfigs.get(landscapeLayerIndex);
int userValue = CollisionTypes.byName(layerConfig.collisionType).mask;
addRigidBody(collisionShape, mass, friction, userValue,
new StandardMotionState(modelInstance.transform));
} else {
btCollisionObject object = new btCollisionObject();
object.setCollisionShape(collisionShape);
object.setWorldTransform(modelInstance.transform);
object.setUserValue(CollisionTypes.WATER.mask);
addCollisionObject(object);
}
}
}
}
示例7: getCollisionShape
import com.badlogic.gdx.physics.bullet.Bullet; //导入方法依赖的package包/类
public btCollisionShape getCollisionShape() {
if (collisionShape == null) {
collisionShape = Bullet.obtainStaticNodeShape(get().nodes);
}
return collisionShape;
}
示例8: init
import com.badlogic.gdx.physics.bullet.Bullet; //导入方法依赖的package包/类
/**
* Needs an initialized com.badlogic.gdx.physics.bullet.Bullet.
*/
public static void init() {
loader = new ObjLoader();
param = new ObjLoader.ObjLoaderParameters(true);
BoundingBox boundingBox = new BoundingBox();
FUEL = load("models/fuel.obj");
FUEL.calculateBoundingBox(boundingBox);
FUEL_SHAPE = new btBoxShape(boundingBox.getDimensions(new Vector3()).scl(0.8f));
SHIELD = load("models/shield.obj");
SHIELD.calculateBoundingBox(boundingBox);
SHIELD_SHAPE = new btBoxShape(boundingBox.getDimensions(new Vector3()).scl(0.8f));
ARTIFACT_MODELS.put(ATTRIBUTE_SPEED, load("models/artifact_speed.obj"));
ARTIFACT_MODELS.put(ATTRIBUTE_INERTIA, load("models/artifact_inertia.obj"));
ARTIFACT_MODELS.put(ATTRIBUTE_LANDSLIDE, load("models/artifact_landslide.obj"));
ARTIFACT_MODELS.put(ATTRIBUTE_FUEL_CAPACITY, load("models/artifact_fuel.obj"));
ARTIFACT_MODELS.put(ATTRIBUTE_SHIELD_CAPACITY, load("models/artifact_shield.obj"));
ARTIFACT_MODELS.put(ATTRIBUTE_SCAN_RADIUS, load("models/artifact_radius.obj"));
ARTIFACT_MODELS.put(ATTRIBUTE_LUCK, load("models/artifact_luck.obj"));
ARTIFACT_MODELS.put(OPERATOR_PLUS, load("models/artifact_plus.obj"));
ARTIFACT_MODELS.put(OPERATOR_MINUS, load("models/artifact_minus.obj"));
ARTIFACT_MODELS.put(OPERATOR_MULTIPLY, load("models/artifact_multiply.obj"));
ARTIFACT_MODELS.put(OPERATOR_DIVIDE, load("models/artifact_divide.obj"));
ARTIFACT_MODELS.put(VALUE_100, load("models/artifact_100.obj"));
ARTIFACT_MODELS.put(VALUE_200, load("models/artifact_200.obj"));
ARTIFACT_MODELS.put(VALUE_500, load("models/artifact_500.obj"));
ARTIFACT_MODELS.put(VALUE_1000, load("models/artifact_1000.obj"));
ARTIFACT_MODELS.put(VALUE_2000, load("models/artifact_2000.obj"));
PLANET_PORTAL = load("models/planetPortal.obj");
PLANET_PORTAL_TORUS = load("models/portalTorus.obj");
PORTAL_STAND_COLLISION = Bullet.obtainStaticNodeShape(PLANET_PORTAL.nodes);
Model portalTorusCollisionModel = load("models/planetPortalCollisionTube.obj");
PORTAL_TUBE_COLLISION = Bullet.obtainStaticNodeShape(portalTorusCollisionModel.nodes);
Model portalTriggerModel = load("models/portalTrigger.obj");
PORTAL_TRIGGER_COLLISION = Bullet.obtainStaticNodeShape(portalTriggerModel.nodes);
RACE_WAY_POINT = load("models/race_waypoint.obj");
RACE_WAY_POINT.calculateBoundingBox(boundingBox);
//Model raceWayPointTrigger = load("models/race_waypoint_trigger.obj");
RACE_WAY_POINT_COLLISION = new btBoxShape(boundingBox.getDimensions(new Vector3()).scl(0.5f));
}