diff --git a/jme3-bullet-native/src/native/cpp/com_jme3_bullet_collision_shapes_GImpactCollisionShape.cpp b/jme3-bullet-native/src/native/cpp/com_jme3_bullet_collision_shapes_GImpactCollisionShape.cpp index f416e46b4..71a3d3742 100644 --- a/jme3-bullet-native/src/native/cpp/com_jme3_bullet_collision_shapes_GImpactCollisionShape.cpp +++ b/jme3-bullet-native/src/native/cpp/com_jme3_bullet_collision_shapes_GImpactCollisionShape.cpp @@ -55,6 +55,18 @@ extern "C" { return reinterpret_cast(shape); } + /* + * Class: com_jme3_bullet_collision_shapes_GImpactCollisionShape + * Method: recalcAabb + * Signature: (J)V + */ + JNIEXPORT void JNICALL Java_com_jme3_bullet_collision_shapes_GImpactCollisionShape_recalcAabb + (JNIEnv *env, jobject object, jlong shapeId) { + btGImpactMeshShape *pShape + = reinterpret_cast (shapeId); + pShape->updateBound(); + } + /* * Class: com_jme3_bullet_collision_shapes_GImpactCollisionShape * Method: finalizeNative @@ -65,7 +77,7 @@ extern "C" { btTriangleIndexVertexArray* array = reinterpret_cast (meshId); delete(array); } - + #ifdef __cplusplus } #endif diff --git a/jme3-bullet/src/main/java/com/jme3/bullet/collision/shapes/GImpactCollisionShape.java b/jme3-bullet/src/main/java/com/jme3/bullet/collision/shapes/GImpactCollisionShape.java index 0f9cfc425..2e5dc9704 100644 --- a/jme3-bullet/src/main/java/com/jme3/bullet/collision/shapes/GImpactCollisionShape.java +++ b/jme3-bullet/src/main/java/com/jme3/bullet/collision/shapes/GImpactCollisionShape.java @@ -36,6 +36,7 @@ import com.jme3.export.InputCapsule; import com.jme3.export.JmeExporter; import com.jme3.export.JmeImporter; import com.jme3.export.OutputCapsule; +import com.jme3.math.Vector3f; import com.jme3.scene.Mesh; import com.jme3.scene.VertexBuffer.Type; import com.jme3.scene.mesh.IndexBuffer; @@ -153,6 +154,23 @@ public class GImpactCollisionShape extends CollisionShape { vertexBase = ByteBuffer.wrap(capsule.readByteArray("vertexBase", new byte[0])); createShape(); } + + /** + * Alter the scaling factors of this shape. + *

+ * Note that if the shape is shared (between collision objects and/or + * compound shapes) changes can have unintended consequences. + * + * @param scale the desired scaling factor for each local axis (not null, no + * negative component, unaffected, default=(1,1,1)) + */ + @Override + public void setScale(Vector3f scale) { + super.setScale(scale); + recalcAabb(objectId); + } + + native private void recalcAabb(long shapeId); /** * Instantiate the configured shape in Bullet.