I'm trying to find the closest vertex on a mesh sphere to a Null but,
even though I've set up the closest location query to do that I always
get the closest point on the surface (not the position of the closest
vertex). Have I just scripted this incorrectly or is there some other
way to 'set' the acceleration cache to do this..?
Here's the simple code:
import win32com.client
def disp(ob):
return win32com.client.Dispatch(ob)
oPlayControl = Application.ActiveProject.Properties("Play Control")
Rate = oPlayControl.Parameters("Rate").Value
oRoot = Application.ActiveSceneRoot
oSphere = oRoot.AddGeometry( "sphere", "MeshSurface" )
oNull = oRoot.AddNull()
oTarget = oRoot.AddNull()
oVec = XSIMath.CreateVector3(5,.5,0)
oNull.LocalTranslation = oVec
oTrans = oSphere.Kinematics.Local.Transform
oSphere.ActivePrimitive.Geometry.SetupClosestLocationQueries(0,oTrans)
oPointLocator =
oSphere.ActivePrimitive.Geometry.GetClosestLocations(oNull.Kinematics.Global.Transform.GetTranslationValues2())
data = oSphere.ActivePrimitive.Geometry.EvaluatePositions(oPointLocator)
Application.LogMessage(data[0])
oVec = XSIMath.CreateVector3(data[0][0],data[1][0],data[2][0])
oTarget.LocalTranslation = oVec
---
Unsubscribe? Mail Majordomo(at)Softimage.COM with the following text in body:
unsubscribe xsi