It kind of depends on the order of rotation. I would recommend extracting the "forward" vector from your viewing matrix. You can the scale this by how far you want to move and there you have it. Much simpler and avoids redoing the trig functions. If your viewing matrix is:

m00 m10 m20 m30m01 m11 m21 m31m02 m12 m22 m32m03 m13 m23 m33

then your forward vector is (m02, m12, m22) and helpfully it is already normalized.

java-gaming.org is not responsible for the content posted by its members, including references to external websites,
and other references that may or may not have a relation with our primarily
gaming and game production oriented community.
inquiries and complaints can be sent via email to the info‑account of the
company managing the website of java‑gaming.org