Fix translateZ and rotation logic