Package de.coreengine.util.bullet
Class Physics
- java.lang.Object
-
- de.coreengine.util.bullet.Physics
-
public class Physics extends Object
Class that contains someuseful jbullet methods- Author:
- Darius Dinger
-
-
Field Summary
Fields Modifier and Type Field Description static float
GRAVITY_OF_EARTH
-
Constructor Summary
Constructors Constructor Description Physics()
-
Method Summary
All Methods Static Methods Concrete Methods Modifier and Type Method Description static com.bulletphysics.collision.shapes.ConvexHullShape
createConvexHullShape(float[] vertices)
Creating a convex hull shape from vertices.static com.bulletphysics.dynamics.DynamicsWorld
createDynamicsWorld(float gravity)
Creating a default JBullet dynamics worldstatic com.bulletphysics.dynamics.RigidBody
createRigidBody(float mass, com.bulletphysics.collision.shapes.CollisionShape shape, boolean rotate)
Creating new RigidBody with a specific shape.static com.bulletphysics.dynamics.RigidBody
createTerrainRigidBody()
Create new terrain rigid body.static com.bulletphysics.collision.shapes.BvhTriangleMeshShape
createTriangleMeshShape(float[] vertices, int[] indices)
Creates a collision shape for a triangle mesh shape.static com.bulletphysics.collision.shapes.BvhTriangleMeshShape
createTriangleMeshShape(float[] vertices, int[][] indices)
Creates a collision shape for a triangle mesh shape.static void
scaleRigidBody(com.bulletphysics.dynamics.RigidBody body, float sx, float sy, float sz, com.bulletphysics.dynamics.DynamicsWorld physicWorld)
Scaling a rigidbody in a dynamics world
-
-
-
Field Detail
-
GRAVITY_OF_EARTH
public static final float GRAVITY_OF_EARTH
- See Also:
- Constant Field Values
-
-
Method Detail
-
createDynamicsWorld
public static com.bulletphysics.dynamics.DynamicsWorld createDynamicsWorld(float gravity)
Creating a default JBullet dynamics world- Parameters:
gravity
- Gravity of the world- Returns:
- Created dynamics world
-
createTriangleMeshShape
public static com.bulletphysics.collision.shapes.BvhTriangleMeshShape createTriangleMeshShape(float[] vertices, int[][] indices)
Creates a collision shape for a triangle mesh shape. Only for static objects!- Parameters:
vertices
- 3D vertices of the bodyindices
- Indices that connect the vertices- Returns:
- Created triangle mesh shaped rigid body
-
createTriangleMeshShape
public static com.bulletphysics.collision.shapes.BvhTriangleMeshShape createTriangleMeshShape(float[] vertices, int[] indices)
Creates a collision shape for a triangle mesh shape. Only for static objects!- Parameters:
vertices
- 3D vertices of the bodyindices
- Indices that connect the vertices- Returns:
- Created triangle mesh shaped rigid body
-
createConvexHullShape
public static com.bulletphysics.collision.shapes.ConvexHullShape createConvexHullShape(float[] vertices)
Creating a convex hull shape from vertices. Also posible for dynamic objects.- Parameters:
vertices
- Vertex positions of the convex hull- Returns:
- Create convex hull shape
-
createRigidBody
public static com.bulletphysics.dynamics.RigidBody createRigidBody(float mass, com.bulletphysics.collision.shapes.CollisionShape shape, boolean rotate)
Creating new RigidBody with a specific shape. A mass of zero means static object.- Parameters:
mass
- Mass of the body (or zero for a static body)shape
- Shape of the bodyrotate
- Can the body rotate- Returns:
- Created rigidy body
-
createTerrainRigidBody
public static com.bulletphysics.dynamics.RigidBody createTerrainRigidBody()
Create new terrain rigid body.- Returns:
- Created terrain rigid body
-
scaleRigidBody
public static void scaleRigidBody(com.bulletphysics.dynamics.RigidBody body, float sx, float sy, float sz, com.bulletphysics.dynamics.DynamicsWorld physicWorld)
Scaling a rigidbody in a dynamics world- Parameters:
body
- Rigidbody to scalesx
- X Scale of the rigid bodysy
- Y Scale of the rigid bodysz
- Z Scale of the rigid bodyphysicWorld
- Dynamic world, the rigid body belongs to
-
-