diff --git a/jme3-blender/src/main/java/com/jme3/scene/plugins/blender/meshes/TemporalMesh.java b/jme3-blender/src/main/java/com/jme3/scene/plugins/blender/meshes/TemporalMesh.java index d4ef0d1bc..da20d3fb4 100644 --- a/jme3-blender/src/main/java/com/jme3/scene/plugins/blender/meshes/TemporalMesh.java +++ b/jme3-blender/src/main/java/com/jme3/scene/plugins/blender/meshes/TemporalMesh.java @@ -46,7 +46,9 @@ import com.jme3.scene.plugins.blender.objects.Properties; */ public class TemporalMesh extends Geometry { private static final Logger LOGGER = Logger.getLogger(TemporalMesh.class.getName()); - + /** A minimum weight value. */ + private static final double MINIMUM_BONE_WEIGHT = FastMath.DBL_EPSILON; + /** The blender context. */ protected final BlenderContext blenderContext; @@ -530,7 +532,11 @@ public class TemporalMesh extends Geometry { for (Entry entry : boneIndexes.entrySet()) { if (vertexGroupsForVertex.containsKey(entry.getKey())) { float weight = vertexGroupsForVertex.get(entry.getKey()); - if (weight > 0) {// no need to use such weights + if (weight > MINIMUM_BONE_WEIGHT) { + // only values of weight greater than MINIMUM_BONE_WEIGHT are used + // if all non zero weights were used, and they were samm enough, problems with normalisation would occur + // because adding a very small value to 1.0 will give 1.0 + // so in order to avoid such errors, which can cause severe animation artifacts we need to use some minimum weight value boneBuffersForVertex.put(weight, entry.getValue()); } }