set oRoot = Application.ActiveProject.ActiveScene.Root
set oCube = oRoot.AddGeometry("Cube","MeshSurface")
oCube.Kinematics.Global.Parameters("posy").value = 4.0
oCube.Kinematics.Global.Parameters("posx").value = 2.0
set oCube2 = oRoot.AddGeometry("Cube","MeshSurface")
oCube2.Kinematics.Global.Parameters("roty").value = 45.0
oCube2.Kinematics.Global.Parameters("posz").value = -2.0
set oTransfo = GetObjectPoseRelativeToOther(oCube, oCube2)
'Function that gets the local pose of an object if it would be parented under another object
Function GetObjectPoseRelativeToOther(in_obj1, in_obj2)
Dim l_srcPose, l_destPose
set l_srcPose = in_obj1.Kinematics.Global.Transform
set l_destPose = in_obj2.Kinematics.Global.Transform
set GetObjectPoseRelativeToOther = XSIMath.MapWorldPoseToObjectSpace(l_srcPose, l_destPose)
End Function |