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
oCube.Kinematics.Global.Parameters("rotx").value = 30
set oTrans = oCube.Kinematics.Local.Transform
set oPos = XSIMath.CreateVector3( 1.0, 1.0, 1.0)
set oObjectPos = XSIMath.MapWorldPositionToObjectSpace(oTrans, oPos)
Application.LogMessage "The position (1,1,1) is (" & oObjectPos.X & "," & oObjectPos.Y & "," & oObjectPos.Z & ") in the cube object space"
set mynull = oCube.AddPrimitive("Null")
mynull.Kinematics.local.Parameters("posx").value = oObjectPos.x
mynull.Kinematics.local.Parameters("posy").value = oObjectPos.y
mynull.Kinematics.local.Parameters("posz").value = oObjectPos.z
|