本文整理汇总了Java中com.bulletphysics.collision.shapes.ConvexHullShape类的典型用法代码示例。如果您正苦于以下问题:Java ConvexHullShape类的具体用法?Java ConvexHullShape怎么用?Java ConvexHullShape使用的例子?那么恭喜您, 这里精选的类代码示例或许可以为您提供帮助。
ConvexHullShape类属于com.bulletphysics.collision.shapes包,在下文中一共展示了ConvexHullShape类的11个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于我们的系统推荐出更棒的Java代码示例。
示例1: addConvexVerticesCollider
import com.bulletphysics.collision.shapes.ConvexHullShape; //导入依赖的package包/类
@Override
public void addConvexVerticesCollider(List<Vector3f> vertices) {
if (vertices.size() > 0) {
float mass = 0f;
Transform startTransform = new Transform();
// can use a shift
startTransform.setIdentity();
startTransform.origin.set(0, 0, -10f);
// this create an internal copy of the vertices
CollisionShape shape = new ConvexHullShape(vertices);
collisionShapes.add(shape);
//btRigidBody* body = m_demoApp->localCreateRigidBody(mass, startTransform,shape);
localCreateRigidBody(mass, startTransform, shape);
}
}
开发者ID:unktomi,项目名称:form-follows-function,代码行数:18,代码来源:BspDemo.java
示例2: addConvexVerticesCollider
import com.bulletphysics.collision.shapes.ConvexHullShape; //导入依赖的package包/类
@Override
public void addConvexVerticesCollider(ObjectArrayList<Vector3f> vertices) {
if (vertices.size() > 0) {
float mass = 0f;
Transform startTransform = new Transform();
// can use a shift
startTransform.setIdentity();
startTransform.origin.set(0, 0, -10f);
// this create an internal copy of the vertices
CollisionShape shape = new ConvexHullShape(vertices);
collisionShapes.add(shape);
//btRigidBody* body = m_demoApp->localCreateRigidBody(mass, startTransform,shape);
localCreateRigidBody(mass, startTransform, shape);
}
}
开发者ID:unktomi,项目名称:form-follows-function,代码行数:18,代码来源:BspDemo.java
示例3: addConvexVerticesCollider
import com.bulletphysics.collision.shapes.ConvexHullShape; //导入依赖的package包/类
@Override
public void addConvexVerticesCollider(ObjectArrayList<Vector3f> vertices) {
if (vertices.size() > 0) {
float mass = 0f;
Transform startTransform = new Transform();
// can use a shift
startTransform.setIdentity();
// JAVA NOTE: port change, we want y to be up.
startTransform.basis.rotX((float) -Math.PI / 2f);
startTransform.origin.set(0, -10, 0);
//startTransform.origin.set(0, 0, -10f);
// this create an internal copy of the vertices
CollisionShape shape = new ConvexHullShape(vertices);
collisionShapes.add(shape);
//btRigidBody* body = m_demoApp->localCreateRigidBody(mass, startTransform,shape);
localCreateRigidBody(mass, startTransform, shape);
}
}
开发者ID:unktomi,项目名称:form-follows-function,代码行数:21,代码来源:CharacterDemo.java
示例4: p3dRuler
import com.bulletphysics.collision.shapes.ConvexHullShape; //导入依赖的package包/类
public void p3dRuler(){
float length = 10/2f;
float width = 10/2f;
List<Vector3f> vertices = new ArrayList<Vector3f>();
vertices.add(new Vector3f(-length,0,-width));
vertices.add(new Vector3f(-length,0,width));
vertices.add(new Vector3f(length,0,width));
vertices.add(new Vector3f(length,0,-width));
Transform startTransform = new Transform();
startTransform.setIdentity();
Vector3f translate = new Vector3f();
startTransform.origin.set(translate);
CollisionShape shape = new ConvexHullShape(vertices);
Vector3f localInertia = new Vector3f(0f, 0f, 0f);
DefaultMotionState myMotionState = new DefaultMotionState(startTransform);
RigidBodyConstructionInfo cInfo = new RigidBodyConstructionInfo(0f, myMotionState, shape, localInertia);
RigidBody body = new RigidBody(cInfo);
body.setGravity(new Vector3f(0,0,0));
pInterfaceWorld.addRigidBody(body);
//adding this to another dynamic world*interfaceworld*
}
开发者ID:Sivx,项目名称:Sivx-3DDesktop,代码行数:22,代码来源:engine - Copy.java
示例5: createShape
import com.bulletphysics.collision.shapes.ConvexHullShape; //导入依赖的package包/类
protected void createShape(float[] points) {
ObjectArrayList<Vector3f> pointList = new ObjectArrayList<Vector3f>();
for (int i = 0; i < points.length; i += 3) {
pointList.add(new Vector3f(points[i], points[i + 1], points[i + 2]));
}
cShape = new ConvexHullShape(pointList);
cShape.setLocalScaling(Converter.convert(getScale()));
cShape.setMargin(margin);
}
开发者ID:mleoking,项目名称:PhET,代码行数:10,代码来源:HullCollisionShape.java
示例6: ConvexPhysicsBody
import com.bulletphysics.collision.shapes.ConvexHullShape; //导入依赖的package包/类
/**
* Creates a convex shaped physics body
* you should define points with respect to center
* The way that this was described to me is that you can take a balloon and blow it up arround the points
* then let it deflate and that is the shape you will be left with.
* @param points the points that define the shape in meters with respect to center
* @param center in meters
* @param mass in kg
*/
public ConvexPhysicsBody(Vector3f[] points, Vector3f center, float mass, int collisionTypes)
{
super(mass, new Quat4f(0,0,0,1), center,
new ConvexHullShape(new ObjectArrayList<javax.vecmath.Vector3f>(points.length)), collisionTypes);
for (Vector3f vec : points)
{
((ConvexHullShape) this.getCollisionShape()).addPoint(PhysicsTools.openGLToBullet(vec));
}
}
开发者ID:l50,项目名称:redrun,代码行数:19,代码来源:ConvexPhysicsBody.java
示例7: getShapeFor
import com.bulletphysics.collision.shapes.ConvexHullShape; //导入依赖的package包/类
private ConvexShape getShapeFor(EntityRef entity) {
BoxShapeComponent box = entity.getComponent(BoxShapeComponent.class);
if (box != null) {
Vector3f halfExtents = new Vector3f(box.extents);
halfExtents.scale(0.5f);
return new BoxShape(halfExtents);
}
SphereShapeComponent sphere = entity.getComponent(SphereShapeComponent.class);
if (sphere != null) {
return new SphereShape(sphere.radius);
}
CapsuleShapeComponent capsule = entity.getComponent(CapsuleShapeComponent.class);
if (capsule != null) {
return new CapsuleShape(capsule.radius, capsule.height);
}
CylinderShapeComponent cylinder = entity.getComponent(CylinderShapeComponent.class);
if (cylinder != null) {
return new CylinderShape(new Vector3f(cylinder.radius, 0.5f * cylinder.height, cylinder.radius));
}
HullShapeComponent hull = entity.getComponent(HullShapeComponent.class);
if (hull != null) {
ObjectArrayList<Vector3f> verts = new ObjectArrayList<Vector3f>();
TFloatIterator iterator = hull.sourceMesh.getVertices().iterator();
while (iterator.hasNext()) {
Vector3f newVert = new Vector3f();
newVert.x = iterator.next();
newVert.y = iterator.next();
newVert.z = iterator.next();
verts.add(newVert);
}
return new ConvexHullShape(verts);
}
CharacterMovementComponent characterMovementComponent = entity.getComponent(CharacterMovementComponent.class);
if (characterMovementComponent != null) {
return new CapsuleShape(characterMovementComponent.radius, characterMovementComponent.height);
}
return null;
}
开发者ID:zoneXcoding,项目名称:Mineworld,代码行数:39,代码来源:PhysicsSystem.java
示例8: createConvexHull
import com.bulletphysics.collision.shapes.ConvexHullShape; //导入依赖的package包/类
public static RigidBody createConvexHull(float mass, Mesh mesh, Vector3f position, Quaternion rotation) {
ObjectArrayList<javax.vecmath.Vector3f> points = new ObjectArrayList<javax.vecmath.Vector3f>();
return createRigidBody(createDefaultRBCI(new ConvexHullShape(points),mass,position,rotation));
}
开发者ID:Axodoss,项目名称:Wicken,代码行数:6,代码来源:PhysicsSystem.java
示例9: ConvexCollisionModel
import com.bulletphysics.collision.shapes.ConvexHullShape; //导入依赖的package包/类
ConvexCollisionModel(Point3d p, DynamicsWorld world, ObjectArrayList<Vector3f> points, int callist){
super(p,callist);
this.points=points;
shape = new ConvexHullShape(points);
initializePhysics(world);
}
开发者ID:seemywingz,项目名称:Kengine,代码行数:7,代码来源:ConvexCollisionModel.java
示例10: toCollisionShape
import com.bulletphysics.collision.shapes.ConvexHullShape; //导入依赖的package包/类
@Override
protected CollisionShape toCollisionShape()
{
return new ConvexHullShape(PhysicsEngine.toBullet(mesh));
}
开发者ID:jglrxavpok,项目名称:jglrEngine,代码行数:6,代码来源:MeshPhysShape.java
示例11: p3dRuler
import com.bulletphysics.collision.shapes.ConvexHullShape; //导入依赖的package包/类
public void p3dRuler(){ float length = 10/2f; float width = 10/2f; List<Vector3f> vertices = new ArrayList<Vector3f>(); vertices.add(new Vector3f(-length,0,-width)); vertices.add(new Vector3f(-length,0,width)); vertices.add(new Vector3f(length,0,width)); vertices.add(new Vector3f(length,0,-width)); Transform startTransform = new Transform(); startTransform.setIdentity(); Vector3f translate = new Vector3f(); startTransform.origin.set(translate); CollisionShape shape = new ConvexHullShape(vertices); Vector3f localInertia = new Vector3f(0f, 0f, 0f); DefaultMotionState myMotionState = new DefaultMotionState(startTransform); RigidBodyConstructionInfo cInfo = new RigidBodyConstructionInfo(0f, myMotionState, shape, localInertia); RigidBody body = new RigidBody(cInfo); body.setGravity(new Vector3f(0,0,0)); pInterfaceWorld.addRigidBody(body); }
开发者ID:Sivx,项目名称:Sivx-3DDesktop,代码行数:2,代码来源:engine.java
注:本文中的com.bulletphysics.collision.shapes.ConvexHullShape类示例整理自Github/MSDocs等源码及文档管理平台,相关代码片段筛选自各路编程大神贡献的开源项目,源码版权归原作者所有,传播和使用请参考对应项目的License;未经允许,请勿转载。 |
请发表评论