Rotation to node not working as intended

So I’m trying set my input to move the model “forward” no matter which direction it faces, “forward” being defined as the direction the model’s nose faces. As it is, I have a node parented to the model so that I can get the chase camera to focus on the node. The problem is that when I rotate the model by way of rotating the node, the forward direction does not change; this is likely due to my misunderstanding of how the coordinates are set up. In either case, my code for moving the node and thus the model is as follows (taken from the analog listener where player is the node):

if(name.equals(“Forward”)) {
Vector3f v = player.getLocalTranslation();
player.setLocalTranslation(v.x, v.y, v.z + value3speed);

How can I achieve my objective of making forward the direction in which the model (or node) faces?

You want to move in the direction the object is facing… so you should move in the direction the objects is facing… ie: get it’s rotation and find the vector that points where it’s facing.

What you are doing would only work if the parent node was what is rotating but that’s probably not what you want.

If you haven’t already then you probably want to go through all of the tutorials. Many of them cover some parts of this and the next 100 other things a lot of people ask.

Firstly, thanks for the quick answer! How would I go about finding the vector pointing to where its facing? I looked at all the tutorials but I didn’t see anything like what I need but that’s not to say it isn’t there.

You might want to look at the links up top and do the math tutorial.

getLocalRotation().mult(Vector3f.UNIT_Z) will give you the 0, 0, 1 vector in local space.

Will do! Thanks again!

So my reformulated question is now this: if I rotate a node, will that alter its origin orientation? I use this term in fashion of how Blender has things set up. I’m hoping that it does and if so, would it be possible to access a particular axis (for example the z axis) as a vector? My misunderstanding of the coordinate system came from the belief that local coordinates in JMonkey have the same meaning as those in Blender ie they describe direction based on the origin of the model.

Rotating a node doesn’t affect the ‘position’ of its origin… because its origin is at 0,0,0 in its own space. No matter how you rotate 0,0,0 it’s still 0,0,0. But all points relative to origin UNDERNEATH that node will be rotated.

To get an axis you use the math I already provided which was exactly how to get the Z axis in the node’s local space.