This one's a bit tricky to explain, so a picture will have to speak a thousand words In any case, what I'm trying to do is have the object move to the left or right of the direction the camera is facing. So instead of moving in relation to (0,0,-1), it would be something like (-.421, 0, -.9) (That would be in the first quadrant)
I get the angle between the camera's direction and straight ahead, as well as convert from radians to degrees, by:
well i dont know exactly how to solve your problem, however, if you were going to be using that angle (35 degrees) it would technically be 125 degrees because 35 degrees is in the first quadrant
one thing you could do is have an invisible box which faces the camera which your graphical object attaches to, and then all you would need to do is to move on a relative Vector3f (meaning the way the object is facing is the z, rather than obsolute which is the worlds Z coordinate) and then you could move the object + or - on the relative X axis. But i dont know if JME does relative, I have never tried.
@Momoko_Fan, so now what would I do with moveDir? That seems to be the direction I want to move the object in… how would I use that in the translation of the object?
You add it as velocity object's translation. This is something you should know from physics class though…
E.g
Vector3f pos = obj.getLocalTranslation();
Vector3f velocity = moveDir.mult(tpf); // time per frame given in update methods
pos = pos.add(velocity);
obj.setLocalTranslation(pos);
You add it as velocity object's translation. This is something you should know from physics class though..
E.g
Vector3f pos = obj.getLocalTranslation();
Vector3f velocity = moveDir.mult(tpf); // time per frame given in update methods
pos = pos.add(velocity);
obj.setLocalTranslation(pos);
oh of course, thanks! BTW, I slept throuogh most of Physics I, definitely enjoyed Physics II though, 'twas uber awesome :D