com.bulletphysics.collision.shapes.ConvexHullShape Java Examples

The following examples show how to use com.bulletphysics.collision.shapes.ConvexHullShape. You can vote up the ones you like or vote down the ones you don't like, and go to the original project or source file by following the links above each example. You may check out the related API usage on the sidebar.
Example #1
Source File: Physical3DWorldAgent.java    From gama with GNU General Public License v3.0 5 votes vote down vote up
private CollisionShape defaultCollisionShape(final IShape geom) {
	final ObjectArrayList<Vector3f> points = new ObjectArrayList<>();
	for (final ILocation loc : geom.getPoints()) {
		points.add(new Vector3f((float) loc.toGamaPoint().x, (float) loc.toGamaPoint().y,
				(float) loc.toGamaPoint().z));
	}
	return new ConvexHullShape(points);
}
 
Example #2
Source File: HullCollisionShape.java    From jmonkeyengine with BSD 3-Clause "New" or "Revised" License 5 votes vote down vote up
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);
}
 
Example #3
Source File: HullCollisionShape.java    From MikuMikuStudio with BSD 2-Clause "Simplified" License 5 votes vote down vote up
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);
}