Ahh, function I see you set the empty array as a float variable, from what I know of MEL you don't have too ? The script worked, although after I run it a few times it fires an error on line 8 ? Where did you get MPosition ?
You're using the -anchorPoint to get the mouse position,but like the documentation says : Which means it will only give you the mouse position when you click somewhere in the viewport.First you need to declare the -pressCommand flag and give it a procedure or any other command to execute.The procedure we are talking about…
MPosition is the name of your context tool here. That's because you're trying to create a context tool twice,which is technically impossible since two tools can't have the same name AFAIK. The line "setToolTo MPosition" is all you need to start the tool if you have already run it at least one time in a Maya session.To make…