trim spaces and replacing value

Hi,
I have a file origFile.txt with values:
origFile.txt
.00~ 145416.02~ xyz~ ram kishor ~? ~ ~783.9
.35~ 765.76~ anh reid~ kelly woodburg ~nancy ~ ~?

Now each row in the file has value for 7 columns with "~" as delimiter.
The requirement was
i)I need to erase the blank spaces between "~" and each column value.
ii) If a column value has a blank space in betwwn (e.g. "ram kishore"), then that blank space shouldn't be removed
iii)If there is no value / only blank spaces in between two consecutive delimiters i.e. "~", then there should
be a single blank space between those two delimiters
iv) If the column value is "?", then the "?" should be removed and the blank spaces should be trimmed for that column value.
i.e. there should not be any value in between the delimiters for that column value.

The output file modFile.txt should look like
modFile.txt
.00~145416.02~xyz~ram kishor~~ ~783.9
.35~765.76~anh reid~kelly woodburg~nancy~ ~

The script I wrote was
sed -e 's/\s*\~\s*/\~/g' -e 's/^\s*//g;' origFile.txt > modFile.txt

The above script solved only the first requirement.
Could anyone please help me in writing the shell script to solve all four requirements listed above?

Try this:

awk -F"~" '
{  for (i=1;i<=NF;i++) {
     if(length($i)>1) {
       sub(/^ */, "", $i);sub(/ *$/, "", $i)
     }
     sub("?","",$i)
   }
}1' OFS="~" origFile.txt > modFile.txt

Thanks a lot @Franklin52
It works fine...