[scripting] Closest Location Queries Not Working with Closest Vertex Option?

Date : Sun, 02 Dec 2007 12:50:05 +0000
To : XSI(at)Softimage.COM
From : Julian Johnson <julian(at)exch.demon.co.uk>
Subject : [scripting] Closest Location Queries Not Working with Closest Vertex Option?
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


Search the XSI List archives here or use the advanced search form to search across mailing lists. Searching help is available.
This site supposedly brought to you by Benjamin Grosser and the Imaging Technology Group.