本文整理汇总了Java中com.bulletphysics.linearmath.MotionState类的典型用法代码示例。如果您正苦于以下问题:Java MotionState类的具体用法?Java MotionState怎么用?Java MotionState使用的例子?那么, 这里精选的类代码示例或许可以为您提供帮助。
MotionState类属于com.bulletphysics.linearmath包,在下文中一共展示了MotionState类的15个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的Java代码示例。
示例1: mkStaticGroundPlane
import com.bulletphysics.linearmath.MotionState; //导入依赖的package包/类
protected void mkStaticGroundPlane(DynamicsWorld world) {
// floor
float mass = 0;
CollisionShape shape = new BoxShape(new Vector3f(L, 10, W));
Transform t = new Transform();
t.setIdentity();
t.origin.set(new Vector3f(p.x,p.y-10,p.z));
MotionState motionState = new DefaultMotionState(t);
RigidBodyConstructionInfo info = new RigidBodyConstructionInfo(mass, motionState, shape);
RigidBody body = new RigidBody(info);
body.setFriction(1f);
body.setRestitution(.5f);
world.addRigidBody(body);
}
示例2: initializePhysics
import com.bulletphysics.linearmath.MotionState; //导入依赖的package包/类
protected void initializePhysics(DynamicsWorld world){
t = new Transform();
t.setIdentity();
t.origin.set(new Vector3f(p.x,p.y,p.z));
Vector3f inertia = new Vector3f(0,0,0);
shape.calculateLocalInertia(p.mass,inertia);
shape.setLocalScaling(new Vector3f(p.size, p.size, p.size));
MotionState motionState = new DefaultMotionState(t);
RigidBodyConstructionInfo info = new RigidBodyConstructionInfo(p.mass,motionState,shape,inertia);
body = new RigidBody(info);
body.setFriction(friction);
body.setDamping(linDamping, angDamping);
body.setAngularFactor(angularFactor);
body.setRestitution(restitution);
Scene.world.addRigidBody(body);
}
示例3: RigidBodyConstructionInfo
import com.bulletphysics.linearmath.MotionState; //导入依赖的package包/类
public RigidBodyConstructionInfo(float mass, MotionState motionState, CollisionShape collisionShape, Vector3 localInertia) {
this.mass = mass;
this.motionState = motionState;
this.collisionShape = collisionShape;
this.localInertia.set(localInertia);
startWorldTransform.setIdentity();
}
示例4: RigidBodyConstructionInfo
import com.bulletphysics.linearmath.MotionState; //导入依赖的package包/类
public RigidBodyConstructionInfo(float mass, MotionState motionState, CollisionShape collisionShape, Vector3f localInertia) {
this.mass = mass;
this.motionState = motionState;
this.collisionShape = collisionShape;
this.localInertia.set(localInertia);
startWorldTransform.setIdentity();
}
示例5: makeBrick
import com.bulletphysics.linearmath.MotionState; //导入依赖的package包/类
/**
* This method creates one individual physical domino.
*/
public RigidBody makeBrick(int i, float mass, Vector3f inertia,
Vector3f loc, float angle) {
brickOrigTransform[i] = new Transform(new Matrix4f(new Quat4f(0f, 0f,
0f, 1f), new Vector3f(loc), 1f));
MotionState brickMotion = new DefaultMotionState(brickOrigTransform[i]);
RigidBodyConstructionInfo brickRigidBodyCI = new RigidBodyConstructionInfo(
mass, brickMotion, brickShape, inertia);
brick[i] = new RigidBody(brickRigidBodyCI);
world.addRigidBody(brick[i]);
return brick[i];
}
示例6: RigidBody
import com.bulletphysics.linearmath.MotionState; //导入依赖的package包/类
public RigidBody (float mass, MotionState motionState, CollisionShape collisionShape) {
this(mass, motionState, collisionShape, new Vector3(0f, 0f, 0f));
}
示例7: getMotionState
import com.bulletphysics.linearmath.MotionState; //导入依赖的package包/类
public MotionState getMotionState () {
return optionalMotionState;
}
示例8: setMotionState
import com.bulletphysics.linearmath.MotionState; //导入依赖的package包/类
public void setMotionState (MotionState motionState) {
this.optionalMotionState = motionState;
if (optionalMotionState != null) {
motionState.getWorldTransform(worldTransform);
}
}
示例9: RigidBody
import com.bulletphysics.linearmath.MotionState; //导入依赖的package包/类
public RigidBody(float mass, MotionState motionState, CollisionShape collisionShape) {
this(mass, motionState, collisionShape, new Vector3f(0f, 0f, 0f));
}
示例10: getMotionState
import com.bulletphysics.linearmath.MotionState; //导入依赖的package包/类
public MotionState getMotionState() {
return optionalMotionState;
}
示例11: setMotionState
import com.bulletphysics.linearmath.MotionState; //导入依赖的package包/类
public void setMotionState(MotionState motionState) {
this.optionalMotionState = motionState;
if (optionalMotionState != null) {
motionState.getWorldTransform(worldTransform);
}
}
示例12: Ground
import com.bulletphysics.linearmath.MotionState; //导入依赖的package包/类
public Ground(Screen screen) {
float size = 100000;
ObjLoader loader = new ObjLoader();
//loader.load("res/snow/snow_terrain.obj");
Model groundModel = new Model();
groundModel.useShader(ShaderProgram.textureShader);
Mesh groundMesh = new Mesh();
groundMesh.setTexture(new Texture("res/snow/CanadianArctic.jpg",GL11.GL_REPEAT));
groundMesh.create(
new float[]{
-size, 0, -size, // down left
-size, 0, size, // up left
size, 0, -size, // down right
size, 0, -size, // down right
size, 0, size, // up right
-size, 0, size // up left
},
null, null,
new float[]{
0, 0,// down left
0, size/50,// up left
size/50, 0,// down right
size/50, 0,// down right
size/50, size/50,// up right
0, size/50,// up left
},
null
);
groundModel.addMesh(groundMesh);
MotionState state2 = new DefaultMotionState(new Transform(MatrixConverter.convert(groundModel.getModel())));
CollisionShape shape2 = new StaticPlaneShape(new Vector3f(0, 1, 0),1f);
RigidBodyConstructionInfo info2 = new RigidBodyConstructionInfo(0f, state2, shape2);
RigidBody body2 = new RigidBody(info2);
body2.setFriction(0.3f);
groundModel.body = body2;
screen.addEntity(groundModel);
}
示例13: setMotionState
import com.bulletphysics.linearmath.MotionState; //导入依赖的package包/类
public void setMotionState(MotionState motionState) {
this.optionalMotionState = motionState;
if (optionalMotionState != null) {
motionState.getWorldTransform(worldTransform);
}
}
示例14: createMotionState
import com.bulletphysics.linearmath.MotionState; //导入依赖的package包/类
public static MotionState createMotionState(Vector3f position, Quaternion rotation) {
return new DefaultMotionState(createTransform(position,rotation));
}
示例15: createDefaultRBCI
import com.bulletphysics.linearmath.MotionState; //导入依赖的package包/类
public static RigidBodyConstructionInfo createDefaultRBCI(CollisionShape shape, float mass, Vector3f position, Quaternion rotation) {
javax.vecmath.Vector3f inertia = new javax.vecmath.Vector3f(0,0,0);
shape.calculateLocalInertia(mass, inertia);
MotionState motionState = createMotionState(position,rotation);
return new RigidBodyConstructionInfo(mass, motionState, shape, inertia);
}