CollisionShape: add isNonMoving() and test buildscript

fix-openal-soft-deadlink
sgold 5 years ago
parent 4ccdd7aae0
commit 3482904c76
  1. 19
      jme3-bullet-native/src/native/cpp/com_jme3_bullet_collision_shapes_CollisionShape.cpp
  2. 13
      jme3-bullet/src/main/java/com/jme3/bullet/collision/shapes/CollisionShape.java

@ -105,6 +105,25 @@ extern "C" {
}
delete(shape);
}
/*
* Class: com_jme3_bullet_collision_shapes_CollisionShape
* Method: isNonMoving
* Signature: (J)Z
*/
JNIEXPORT jboolean JNICALL Java_com_jme3_bullet_collision_shapes_CollisionShape_isNonMoving
(JNIEnv *env, jobject object, jlong shapeId) {
btCollisionShape *pShape
= reinterpret_cast<btCollisionShape *> (shapeId);
if (pShape == NULL) {
jclass newExc = env->FindClass("java/lang/NullPointerException");
env->ThrowNew(newExc, "The native object does not exist.");
return false;
}
return pShape->isNonMoving();
}
#ifdef __cplusplus
}
#endif

@ -129,6 +129,19 @@ public abstract class CollisionShape implements Savable {
return scale;
}
/**
* Test whether this shape can be applied to a dynamic rigid body. The only
* non-moving shapes are the heightfield, mesh, and plane shapes.
*
* @return true if non-moving, false otherwise
*/
public boolean isNonMoving() {
boolean result = isNonMoving(objectId);
return result;
}
native private boolean isNonMoving(long objectId);
/**
* Read the collision margin for this shape.
*

Loading…
Cancel
Save