Weird loop problem

Hi there!



I started a little project in jme3 to learn more about maths (this is the tutorial: https://wiki.jmonkeyengine.org/legacy/doku.php/jme3:math) and I found a weird problem. In the update loop, if I only put this: [java]angle += (float)Math.toRadians(10);

geom.getLocalRotation().fromAngleAxis(angle, axis);java]



then the loop will be called <strong>only once at the beginning of the game.</strong>

But if I do this: [java]angle += (float)Math.toRadians(10);

geom.getLocalRotation().fromAngleAxis(angle, axis);

geom.scale(1f);[/java]



the loop won’t stop at the beginning. Do you know why, if I don’t scale the geometry, the loop doesn’t update?



Thank you :slight_smile:

You cannot go get().set() on a rotation or any math value you get from a spatial, instead do:

[java]Quaternion quat= geom.getLocalRotation();

quat.fromAngleAxis(angle,axis);

geom.setLocalRotation(quat);[/java]

Thanks



But if I do geom.scale(), I actually can do get().set(). Anyway, I’ll just do it your way. :slight_smile:

Its because the scale() method, as well as the setLocalRotation() method, updates the geometries world/local information after setting the local transform. If you just change the local transform without the spatial noticing the world location will not be updated.