Merge pull request #1507 from QuantumCoderQC/master

Moved kinematic and static flags from Bt.hx to RigidBody.hx
This commit is contained in:
Lubos Lenco 2019-12-08 10:04:49 +01:00 committed by GitHub
commit 24ec5cf79b
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23
2 changed files with 11 additions and 6 deletions

View File

@ -64,6 +64,11 @@ class RigidBody extends iron.Trait {
static var trans2:bullet.Bt.Transform;
static var quat = new Quat();
static var CF_STATIC_OBJECT= 1;
static var CF_KINEMATIC_OBJECT= 2;
static var CF_NO_CONTACT_RESPONSE = 4;
static var CF_CHARACTER_OBJECT = 16;
static var convexHullCache = new Map<MeshData, bullet.Bt.ConvexHullShape>();
static var triangleMeshCache = new Map<MeshData, bullet.Bt.TriangleMesh>();
static var usersCache = new Map<MeshData, Int>();
@ -254,12 +259,12 @@ class RigidBody extends iron.Trait {
setAngularFactor(angularFactors[0], angularFactors[1], angularFactors[2]);
}
if (trigger) bodyColl.setCollisionFlags(bodyColl.getCollisionFlags() | bullet.Bt.CollisionObject.CF_NO_CONTACT_RESPONSE);
if (trigger) bodyColl.setCollisionFlags(bodyColl.getCollisionFlags() | CF_NO_CONTACT_RESPONSE);
if (animated){
bodyColl.setCollisionFlags(bodyColl.getCollisionFlags() | bullet.Bt.CollisionObject.CF_KINEMATIC_OBJECT);
bodyColl.setCollisionFlags(bodyColl.getCollisionFlags() & ~bullet.Bt.CollisionObject.CF_STATIC_OBJECT);
bodyColl.setCollisionFlags(bodyColl.getCollisionFlags() | CF_KINEMATIC_OBJECT);
bodyColl.setCollisionFlags(bodyColl.getCollisionFlags() & ~CF_STATIC_OBJECT);
}
if (staticObj && !animated) bodyColl.setCollisionFlags(bodyColl.getCollisionFlags() | bullet.Bt.CollisionObject.CF_STATIC_OBJECT);
if (staticObj && !animated) bodyColl.setCollisionFlags(bodyColl.getCollisionFlags() | CF_STATIC_OBJECT);
if (ccd) setCcd(transform.radius);
@ -458,7 +463,7 @@ class RigidBody extends iron.Trait {
if(animated)
body.getMotionState().setWorldTransform(trans1);
else
body.setWorldTransform(trans1);
body.setCenterOfMassTransform(trans1);
if (currentScaleX != t.scale.x || currentScaleY != t.scale.y || currentScaleZ != t.scale.z) setScale(t.scale);
activate();
}

View File

@ -2236,7 +2236,7 @@ class ArmoryExporter:
elif rb.collision_shape == 'CAPSULE':
shape = 6
body_mass = rb.mass
is_static = (not rb.enabled and not rb.kinematic) or (rb.type == 'PASSIVE' and rb.kinematic)
is_static = (not rb.enabled and not rb.kinematic) or (rb.type == 'PASSIVE' and not rb.kinematic)
if is_static:
body_mass = 0
x = {}