当前位置: 首页>>代码示例>>Java>>正文


Java ConvexShape.setLocalScaling方法代码示例

本文整理汇总了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);
        }
    }
}
 
开发者ID:zoneXcoding,项目名称:Mineworld,代码行数:22,代码来源:PhysicsSystem.java

示例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);
    }
}
 
开发者ID:zoneXcoding,项目名称:Mineworld,代码行数:14,代码来源:PhysicsSystem.java


注:本文中的com.bulletphysics.collision.shapes.ConvexShape.setLocalScaling方法示例由纯净天空整理自Github/MSDocs等开源代码及文档管理平台,相关代码片段筛选自各路编程大神贡献的开源项目,源码版权归原作者所有,传播和使用请参考对应项目的License;未经允许,请勿转载。