Nearest Point On Mesh in Maya

297 views
Skip to first unread message

jeemse...@gmail.com

unread,
May 4, 2017, 4:04:24 AM5/4/17
to Python Programming for Autodesk Maya
Hey guys,
I need some help with the script. I have no idea about scripting. I am watching a tutorial for making grass in Maya 2016. I am at the point where I am trying to write the script where the grass faces the normals so the grass goes with the uneven surface of the land. Below is the code that is there in the script. Kindly let me know what is wrong as I keep getting the error "//Error: 4.15: Syntax error"
the code I am writing is " vector $nrm = 'nearestPointOnMesh -1p ($p.x) ($p.y) ($p.z) -normal -q pPlane'; "

I am using nparticles and have added few expressions, everything else is working fine but when I add the above line the error appears. Is there another way to do this? please you can suggest and tutorial as well if anything available.
Regards
Junaid.

Michael Boon

unread,
May 4, 2017, 5:09:37 PM5/4/17
to Python Programming for Autodesk Maya
The little apostrophe character you're using should be `, not '
On a US keyboard, that's the key above Tab. I don't know what it's called (and I've never seen it used for anything other than MEL).

Robert White

unread,
May 5, 2017, 8:03:24 AM5/5/17
to Python Programming for Autodesk Maya
` is usually referred to as the backtick.

Alok Gandhi

unread,
May 5, 2017, 12:27:29 PM5/5/17
to python_in...@googlegroups.com
The little apostrophe character you're using should be `, not '
On a US keyboard, that's the key above Tab. I don't know what it's called (and I've never seen it used for anything other than MEL).
Use of backticks (``) is rare in python, but they are legal in python 2.x (deprecated in python 3) and are an equivalent of the special method __repr__(). Other than python 2.x they mean different things in other programming languages. For example, they are freely used in a bash script. The text between backticks is executed and replaced by the output of the command (minus the trailing newline characters), in Perl, they are almost used same as in bash script (to execute a statement but never return).

--
You received this message because you are subscribed to the Google Groups "Python Programming for Autodesk Maya" group.
To unsubscribe from this group and stop receiving emails from it, send an email to python_inside_maya+unsub...@googlegroups.com.
To view this discussion on the web visit https://groups.google.com/d/msgid/python_inside_maya/4693d98c-62c4-4599-9618-f871c2850967%40googlegroups.com.
For more options, visit https://groups.google.com/d/optout.



--
Reply all
Reply to author
Forward
0 new messages