[SOLVED] Move to rotation direction

Basically i try to take node rotation and then move it in direction of rotation but cant.
i tried both

  if (name.equals("WalkBackward") player.getLocalTranslation().getZ(){

     float[] angles= new float[3];
     player.getLocalRotation().toAngles(angles);

      Vector3f direction= new Vector3f(angles[0], angles[1], angles[2]);
       
       direction.normalize();
      player.setLocalTranslation(player.getLocalTranslation().add(direction.normalize().divide(100)));
         }

and

           player.getLocalRotation().toAngleAxis(direction);

but my object runs in same direction and no matter if i rotate node

Wow… long way to go for a simple thing.

Vector3f direction = player.getLocalRotation().mult(Vector3f.UNIT_Z);
player.move(direction.divide(100));

…I guess you are trying to move a centemeter at a time no matter what the frame rate is?

You should read the math for dummies and stuff links because you have no idea at all what a direction vector is.

“You should read the math for dummies and stuff links because you have no idea at all what a direction vector is.”
i actually did ,did not helped alot ,i just try to do the most simple things soo i hape to fine some combos i dont need to undestand soo i can you them (like that mad stuff do this … soo copy paste it give some data it need to have and see miracle happens")

aint move is a bit different from setLocalTranslation?
is that possible to use rotation to get data for LocalTranslation?
and in this case i need to move backward ,soo i would need invert direction(suppose just change positive to negative

Any way thnx for reply :slight_smile:

move() is like setLocalTranslation(getLocalTranslation.add())…which is what you were doing before.

That’s what I showed you. You want to move forward. So rotate local forward to world forward.

Asking it for a bunch of euler angles is never going to be helpful.

direction.negateLocal()

Super-simple stuff.

Or just divide by -100 instead. Or just multiply by -tpf or whatever.

I recommend reading this every day until it all makes sense:
https://wiki.jmonkeyengine.org/tutorials/math/assets/fallback/index.html

thnx :slight_smile: