I'm so confused!

I'm so confused!



I had see so many topics about rotating a node/model and i can't find the answer that's why I have created this topic.



Ok, my question:



HOW TO ROTATE A MODEL, BY ITS X-AXIS?

do you know your trigonometry?



specifically your use of the unit cirlce and radians.



ok, so


   float gunAngle = 0;
   Quaternion quat = new Quaternion();
  Node rototum = new Node("Rototum!!");
  public void doRotate(float frac, float i){
        Vector3f vec = new Vector3f();
      vec.set(0, 1, 0);

      gunAngle = FastMath.PI*frac;
      quat.fromAngleNormalAxis(gunAngle, vec);
      rototum.setLocalRotation(quat);
      rototum.updateGeometricState(0,true);
      rototum.updateWorldVectors();
      rototum.updateWorldBound();      
  }



fraction is to attain different locations on the unit circle, notice it is frac * pi, so if you want 90 degrees, make frac = .5, etc

also, you can change the 1 position of Vector3fvec to rotate about different axises. rototum = to your node you want to rotate. that should work.

I was just wondering about these lines:

rototum.updateGeometricState(0,true);
      rototum.updateWorldVectors();
      rototum.updateWorldBound();   



Aren't the two latter methods called in the former?

Hey, can i do it not in a method like doRotate? cause the model is in simpleGameInit, and i can't put a mthod in a method :confused:




Well write it outside then^^



Also I suggest learning the baiscs of java, else you wont get happy with jme;)