I hope this is the right forum for thisquestion. Since it is, in my mind, about vectors and planes and such,which I was first introduced to during my university linear algebraclasses, I figure it belongs here and hope someone can help me. If itdoes not belong here, I apologize and hope that a moderator can movethe question to the appropriate forum.

Background:
I am trying to build a 3D controllerfor a game and have run into an issue that I cannot solve. I think Imight best explain the problem using two examples of how I would likeit to work. It has been a while since I took those linear algebraclasses, so my terminology is probably are off but hopefully it willbe clear enough.


Assumptions:
Left-handed coordinate system. We havea sphere with a radius of 0.5 with its center located at (0, 0.5, 0).The sphere can be moved with input on the x- and z-axis. I guess wecan consider the center of the sphere the only thing of importance,but maybe a sphere can help build a visual image. The input vector totranslate the ball with in both examples below is (1, 0, 1)


Problem:
I need to find a directional vector touse for moving the sphere, regardless of the rotation (all axes) ofthe plane below the sphere before the movement of the sphere.


Examples:
Example 1: We have a xz-plane locatedat y = 0, so the sphere is in contact with the surface of the plane.After moving the sphere along the input vector, the sphere will belocated at (0, 0.5, 0) + (1, 0, 1) = (1, 0.5, 1)
Example 2: We have rotated the planefrom Example 1 89 degress around the z-axis and moved it ~0.5 in thex-axis (cannot use rotate 90 degrees and exact movement since itwould make it hard to illustrate why the sphere should be moved theway I want it to move). The sphere is still in contact with thesurface of the plane, but from the side. If we were to move thesphere using the input vector it would move through the plane, but wewant the sphere to move parallel to the plane. We want to rotate?the input vector somehow. The final position of the sphere should beroughly (0.05, 0.95, 1), that is, the final resting place of thesphere should be the same as if we were to rotate the final positionof the sphere from Example 1 around the world z-axis the same numberof degrees as the plane is rotated around the z-axis.

Available data:

The information we have available to usis the normal of the plane, the position of the sphere and the inputdirection vector. Is this information enough to be able to solve myproblem, and if so, how? I have tried to figure it out, but my mathskills are not up to par.