See this thread for the bugreport: http://www.jmonkeyengine.com/jmeforum/index.php?topic=11355.0
calling updateGeometry on a arrow corrupts the arrow because the rotation of the cylinder and translation of the pyramid are lost.
Same with Axisrods.
Test to reproduce the problem:
Arrow a = new Arrow("a", 10, 1);
a.updateGeometry(2, 0.1f);
rootNode.attachChild(a);
Patch:
Index: src/com/jme/scene/shape/Arrow.java
===================================================================
--- src/com/jme/scene/shape/Arrow.java (revision 4389)
+++ src/com/jme/scene/shape/Arrow.java (working copy)
@@ -140,7 +140,12 @@
} else {
shaft.updateGeometry(4, 16, width * .75f, width * .75f, length,
false, false);
+ Quaternion q = new Quaternion();
+ q.fromAngles(90 * FastMath.DEG_TO_RAD, 0, 0);
+ shaft.rotatePoints(q);
+ shaft.rotateNormals(q);
tip.updateGeometry(2 * width, length / 2f);
+ tip.translatePoints(0, length * .75f, 0);
}
}
Index: src/com/jme/scene/shape/AxisRods.java
===================================================================
--- src/com/jme/scene/shape/AxisRods.java (revision 4389)
+++ src/com/jme/scene/shape/AxisRods.java (working copy)
@@ -125,6 +125,7 @@
this.length = length;
this.width = width;
this.rightHanded = rightHanded;
+ int dir = rightHanded ? 1 : -1;
if (xAxis == null) {
xAxis = new Arrow("xAxis", length, width);
xAxis.setSolidColor(X_AXIS_COLOUR);
@@ -137,14 +138,20 @@
attachChild(yAxis);
zAxis = new Arrow("zAxis", length, width);
zAxis.setSolidColor(Z_AXIS_COLOUR);
- int dir = rightHanded ? 1 : -1;
zAxis.getLocalRotation().fromAngles(dir * 90 * FastMath.DEG_TO_RAD, 0, 0);
zAxis.getLocalTranslation().addLocal(0, 0, dir * length * 0.5f);
attachChild(zAxis);
} else {
xAxis.updateGeometry(length, width);
+ xAxis.getLocalRotation().fromAngles(0,0,-90*FastMath.DEG_TO_RAD);
+ xAxis.getLocalTranslation().set(length*.5f, 0, 0);
+
yAxis.updateGeometry(length, width);
+ yAxis.getLocalTranslation().set(0, length*.5f, 0);
+
zAxis.updateGeometry(length, width);
+ zAxis.getLocalRotation().fromAngles(dir * 90 * FastMath.DEG_TO_RAD, 0, 0);
+ zAxis.getLocalTranslation().set(0, 0, dir * length * 0.5f);
}
}