globaldict get xyz original pos and apply it to cube on press key???

Hi!

thanks for reading!

I have a flying cube thats slightly rotated on x, when press up arrow it moves forward.

when press left arrow it moves left etc.

but when press up AND left or down and left/right (ascend descend its a plane) the original position of the cube level and perpendicularity to z x y horizon is lost.

I need somebody extremely kind who would make me a script that
a) gets current rotation of cube when up key or down key is pressed (ascend /descend, which can be the L and M keys). if L or M key depressed, then the script records the original rotation degree of the cube in globaldict.

but it must record the position before the ascend descend rotation begines. also if easier, it could simply record the original position before take of. when press the up arrow key it goes forward and that is original position. this rotation degree is fixed so probably better way.

b) then when up or down key is “released” - script checks xyz rotation of cube and if not matching adjust the cube in game on the fly very “gradually” this speed of return to original position should be in the code and can be edited. looking for subtle move back to original.

c) this occurs whenever the L or M keys are pressed and released. (record original cube rotation xyz which only needs to happen once really, and keys (either one) released, script checks current in game position of the cube and applys new rotation gradually back to original position)

looking forward to hearing from someone!