本文整理汇总了Java中com.bulletphysics.collision.shapes.ConvexShape.setLocalScaling方法的典型用法代码示例。如果您正苦于以下问题:Java ConvexShape.setLocalScaling方法的具体用法?Java ConvexShape.setLocalScaling怎么用?Java ConvexShape.setLocalScaling使用的例子?那么恭喜您, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类com.bulletphysics.collision.shapes.ConvexShape
的用法示例。
在下文中一共展示了ConvexShape.setLocalScaling方法的2个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的Java代码示例。
示例1: createRigidBody
import com.bulletphysics.collision.shapes.ConvexShape; //导入方法依赖的package包/类
private void createRigidBody(EntityRef entity) {
LocationComponent location = entity.getComponent(LocationComponent.class);
RigidBodyComponent rigidBody = entity.getComponent(RigidBodyComponent.class);
ConvexShape shape = getShapeFor(entity);
if (shape != null) {
float scale = location.getWorldScale();
shape.setLocalScaling(new Vector3f(scale, scale, scale));
Vector3f fallInertia = new Vector3f();
shape.calculateLocalInertia(rigidBody.mass, fallInertia);
RigidBodyConstructionInfo info = new RigidBodyConstructionInfo(rigidBody.mass, new EntityMotionState(entity), shape, fallInertia);
RigidBody collider = new RigidBody(info);
collider.setUserPointer(entity);
updateKinematicSettings(rigidBody, collider);
RigidBody oldBody = entityRigidBodies.put(entity, collider);
physics.addRigidBody(collider, Lists.<CollisionGroup>newArrayList(rigidBody.collisionGroup), rigidBody.collidesWith);
if (oldBody != null) {
physics.removeRigidBody(oldBody);
}
}
}
示例2: createTrigger
import com.bulletphysics.collision.shapes.ConvexShape; //导入方法依赖的package包/类
private void createTrigger(EntityRef entity) {
LocationComponent location = entity.getComponent(LocationComponent.class);
TriggerComponent trigger = entity.getComponent(TriggerComponent.class);
ConvexShape shape = getShapeFor(entity);
if (shape != null) {
float scale = location.getWorldScale();
shape.setLocalScaling(new Vector3f(scale, scale, scale));
List<CollisionGroup> detectGroups = Lists.newArrayList(trigger.detectGroups);
PairCachingGhostObject triggerObj = physics.createCollider(location.getWorldPosition(), shape, Lists.<CollisionGroup>newArrayList(StandardCollisionGroup.SENSOR), detectGroups, CollisionFlags.NO_CONTACT_RESPONSE);
triggerObj.setUserPointer(entity);
entityTriggers.put(entity, triggerObj);
}
}