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
|