use of org.terasology.engine.physics.shapes.ConvexHullShape in project Terasology by MovingBlocks.
the class BlockShapeTest method testConvexHull.
@Test
public void testConvexHull() {
BlockShape blockShape = assetManager.getAsset("engine:halfSlope", BlockShape.class).get();
CollisionShape shape = blockShape.getCollisionShape(Rotation.rotate(Yaw.CLOCKWISE_90));
assertTrue(shape instanceof ConvexHullShape);
Vector3f[] test = new Vector3f[] { new Vector3f(0.49999997f, 0.0f, 0.49999997f), new Vector3f(-0.49999997f, -0.49999997f, 0.49999997f), new Vector3f(0.49999997f, -0.49999997f, 0.49999997f), new Vector3f(0.49999997f, 0.0f, -0.49999997f), new Vector3f(0.49999997f, -0.49999997f, -0.49999997f), new Vector3f(-0.49999997f, -0.49999997f, -0.49999997f), new Vector3f(0.49999997f, -0.49999997f, 0.49999997f), new Vector3f(0.49999997f, -0.49999997f, -0.49999997f), new Vector3f(0.49999997f, 0.0f, -0.49999997f), new Vector3f(0.49999997f, 0.0f, 0.49999997f), new Vector3f(0.49999997f, -0.49999997f, 0.49999997f), new Vector3f(-0.49999997f, -0.49999997f, 0.49999997f), new Vector3f(-0.49999997f, -0.49999997f, -0.49999997f), new Vector3f(0.49999997f, -0.49999997f, -0.49999997f), new Vector3f(0.49999997f, 0.0f, -0.49999997f), new Vector3f(-0.49999997f, -0.49999997f, -0.49999997f), new Vector3f(-0.49999997f, -0.49999997f, 0.49999997f), new Vector3f(0.49999997f, 0.0f, 0.49999997f) };
BulletConvexHullShape bulletConvexHullShape = (BulletConvexHullShape) shape;
// TODO: Test fails because native library is not loaded
for (int x = 0; x < ((btConvexHullShape) bulletConvexHullShape.underlyingShape).getNumPoints(); x++) {
fuzzVectorTest(test[x], ((btConvexHullShape) bulletConvexHullShape.underlyingShape).getScaledPoint(x));
}
}
Aggregations