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 = oCube.AddGeometry("Cube","MeshSurface")
oCube2.Kinematics.Global.Parameters("posz").value = 3.0
oCube2.Kinematics.Global.Parameters("rotx").value = 45.0
set oCone = oRoot.AddGeometry("Cone", "MeshSurface")
oCone.Kinematics.Global.Parameters("posy").value = -2.0
oCone.Kinematics.Global.Parameters("posz").value = 90.0
set oTrans = oCube.Kinematics.Local.Transform
set oTransParent = oCube2.Kinematics.Global.Transform
set oVec3 = XSIMath.CreateVector3
oTrans.GetTranslation oVec3
set oDestinationTrans = oCone.Kinematics.Global.Transform
Application.LogMessage "The translation of the cube relative to its parent: x " & _
oVec3.x & " y " & oVec3.y & " z " & oVec3.z
set oObjectTrans = XSIMath.MapObjectPoseToObjectSpace(oTransParent, oDestinationTrans,oTrans)
oObjectTrans.GetTranslation oVec3
Application.LogMessage "The translation of the cube relative to the cone: x " & _
oVec3.x & " y " & oVec3.y & " z " & oVec3.z
|