How does jmonkey calculate spatial rotation?

Hello, I was wondering how does Jmonkey calculate the root Node tree rotation?

Does he recursively call a rotate function and calculate the next node rotation base on the parent node rotation?

I m trying to find a way to rotate an Abstract polygon made of Vector2f and then use the polygon rotation to find if a point is inside the actual polygon. It’s for damage detection.

http://wiki.jmonkeyengine.org/doku.php/jme3:scenegraph_for_dummies

Beyond that I don’t understand the question. Transforms are concatenated down the tree like every other scene graph. Google probably has a million hits on this subject.

As to your other, you might need to draw a picture… since by definition a 2D polygon cannot really ever contain a 3D point. If you mean you are trying to sweep it around in a circle in some 3D shape and see if the polygon is in that, I suspect you have your work cut out for you. Though if you really want to go with the iterative approach of sweeping you might get by with a distance to triangle function.

In the end, you will probably want to explain what you are actually trying to do.

My question as nothing to do with geometry in the 3d space.

Is there a optimized way to rotate the 4 vector2f location with out doing a recursive call to the polygon. It s kind of abstract i know, but I m trying to make a fighting system base on location and limit. Would i have to update the vector2f every attack/every frame or is there a way the graphics engine use to update the spatial rotation efficiently?

If you don’t understand my question, it s not a problem. I will make the first algorithm I have in mind and search in the future for a better way.

My way would be to rotate the 4 vector2f using a mathematics call to calculate the rotation(using sin/cos) from an origin and the distance every game frame.

Usually, in 2D you’d rotate with a 2x2 matrix. You could even use Java’s AWT stuff or just about any math package.

You could also use jme math if you use Vector3f and Quaternion and just ignore the z field.

I wrote a software cursor that does exactly that: rotation around the cursor point.
I used the standard guiNode and Picture and Vector3f etc - it works perfectly.
Since your “rotation origin” is not at the center - you need a “pivotNode” too.

This user had the same problem: Picture on Hud is rotating around bottom corner instead of middle
We solved this back then. :chimpanzee_smile: