XSIMath.MapObjectOrientationToWorldSpace

説明

指定されたObjectSpace で記述された方向を、WorldSpace に変換します。

スクリプト 構文

oReturn = XSIMath.MapObjectOrientationToWorldSpace( ObjectSpace, Orientation );

戻り値

SIVector3(向き)

パラメータ

パラメータ タイプ 詳細
ObjectSpace SITransformation 方向が記述されているObjectSpace
向き SIVector3 変換する方向

1. JScript の例

NewScene(null, false);
var oRoot = Application.ActiveSceneRoot;
var 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 = 45.0;
var oTrans = oCube.Kinematics.Local.Transform;
var aNormal = new VBArray( oCube.ActivePrimitive.Geometry.Facets.NormalArray );
var oOri = XSIMath.CreateVector3();
oOri.x = aNormal.getItem(0,1);
oOri.y = aNormal.getItem(1,1);
oOri.z = aNormal.getItem(2,1);
Application.LogMessage (aNormal.getItem(0,1));
Application.LogMessage (aNormal.getItem(1,1));
Application.LogMessage (aNormal.getItem(2,1));
var oObjectOri = XSIMath.MapObjectOrientationToWorldSpace(oTrans, oOri);
Application.LogMessage  ("The y unit vector  is represented by (" + 
                                XSIMath.RadiansToDegrees(oObjectOri.X) + "," + 
                                XSIMath.RadiansToDegrees(oObjectOri.Y) + "," + 
                                XSIMath.RadiansToDegrees(oObjectOri.Z) + ") in the cube object space");
// Expected results:
//INFO : The y unit vector  is represented by (0,-40.51423422706978,-40.51423422706977) 
//                      in the cube object space

2. VBScript の例

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 = 45.0
set oTrans = oCube.Kinematics.Local.Transform
set oOri = XSIMath.CreateVector3
aNormal = oCube.ActivePrimitive.Geometry.Facets.NormalArray
oOri.x = aNormal(0,2)
oOri.y = aNormal(1,2)
oOri.z = aNormal(2,2)
set oObjectOri = XSIMath.MapObjectOrientationToWorldSpace(oTrans, oOri)
Application.LogMessage  "The y unit vector  is represented by (" & _
                                XSIMath.RadiansToDegrees(oObjectOri.X) & "," & _
                                XSIMath.RadiansToDegrees(oObjectOri.Y) & "," & _
                                XSIMath.RadiansToDegrees(oObjectOri.Z) & ") in the cube object space"