PDA

View Full Version : Goals based on closestPointOnSurface

 Kyrish08-21-2007, 06:33 PMHi all-) I have some problems with such task. I have one nurbs Sphere (nurbsSphereShape1) which is emitting particles. I created another nurbs Sphere (nurbsSphereShape2) with the same center but with bigger radius. Second sphere should be the goal for particles. In more details - basing on birth place of particle (parentU,parentV) I want to assign to particle nearest CV of second sphere as the goal. For that I wrote such creation expression: print(time + " "); float \$pointXYZ[]; float \$pointU = particleShape1.parentU; float \$pointV = particleShape1.parentV; print("birth UV coords : " + \$pointU + " " + \$pointV + "\n"); \$pointXYZ=`pointOnSurface -u \$pointU -v \$pointV -position nurbsSphereShape1`; print("birth XYZ coords:" + \$pointXYZ[0] + " " + \$pointXYZ[1] + " " + \$pointXYZ[2] + "\n"); closestPointOnSurface1.inPositionX = \$pointXYZ[0]; closestPointOnSurface1.inPositionY = \$pointXYZ[1]; closestPointOnSurface1.inPositionZ = \$pointXYZ[2]; float \$closestPointXYZ[]; \$closestPointXYZ[0] = closestPointOnSurface1.positionX; \$closestPointXYZ[1] = closestPointOnSurface1.positionY; \$closestPointXYZ[2] = closestPointOnSurface1.positionZ; float \$closestPointUV[]; \$closestPointUV[0] = closestPointOnSurface1.parameterU; \$closestPointUV[1] = closestPointOnSurface1.parameterV; print("closest point XYZ coords: " + \$closestPointXYZ[0] + " " + \$closestPointXYZ[1] + " " + \$closestPointXYZ[2] + "\n"); print("closest point UV coords: " + \$closestPointUV[0] + " " + \$closestPointUV[1] + "\n"); //trying to obtain the closest CV's UV coordinates. May be it's a strange way but I have not //any idea... string \$temp[]; string \$stringPointU = \$closestPointUV[0]; string \$stringPointV = \$closestPointUV[1]; int \$vertexU; int \$vertexV; \$temp = stringToStringArray(\$stringPointU , "."); \$vertexU = \$temp[0]; \$temp = stringToStringArray(\$stringPointV , "."); \$vertexV = \$temp[0]; print(\$vertexU + " " + \$vertexV + "\n"); particleShape1.goalU = \$vertexU; particleShape1.goalV = \$vertexV; print("next particle..." + "\n"); There are a lot print outputs just for controling the script flow. So...It seems like something wrong in work with closestPointOnSurface node. Node was created by following steps: createNode closestPointOnSurface; connectAttr closestPointOnSurface1.is nurbsSphereShape2.ws; If You look at the scene You will see that particles goals coordinates set up in strange way-( Plz help with explanation what is wrong or how I can achieve this effect in another way. Thank You!
CGTalk Moderation
08-21-2007, 06:33 PM
This thread has been automatically closed as it remained inactive for 12 months. If you wish to continue the discussion, please create a new thread in the appropriate forum.