XSIMath.MapWorldPositionToObjectSpace

Description

Converts a position described in WorldSpace to a position in a different ObjectSpace.

C# Syntax

SIVector3 XSIMath.MapWorldPositionToObjectSpace( SITransformation in_pObjectSpace, SIVector3 in_pPosition );

Scripting Syntax

oReturn = XSIMath.MapWorldPositionToObjectSpace( ObjectSpace, Position );

Return Value

The new SIVector3 position.

Parameters

Parameter Type Description
ObjectSpace SITransformation ObjectSpace in which we want to convert the position.
Position SIVector3 Position to convert.

Examples

VBScript Example

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