#
# This example shows how to modify the state of a transform
# when you are working on a copy of the object.
#
app = Application
null = None
false = 0
app.NewScene (null, false)
oRoot = app.ActiveSceneRoot
oCube = oRoot.AddGeometry("Cube","MeshSurface", "Cube")
# Retrieve a copy of the transform object
oTrans = oCube.Kinematics.Local.GetTransform2(null)
oMat4 = XSIMath.CreateMatrix4();
oMat4.Set( 1.0, 1.0, 0.0, 10.0, 0.0, 1.0, 0.0, 0.0, 0.0, 0.0, 1.0, 0.0,0.0, 0.0, 0.0, 1.0 );
# Warning: you cannot change the object's transform like this:
# oCube.Kinematics.Local.Transform.SetMatrix4(oMat4);
# because this will only modify a copy of the transform object
# not the real state of oCube.Kinematics.Local.Transform
oTrans.SetMatrix4(oMat4);
# Replace the transform with the modified copy
oCube.Kinematics.Local.PutTransform2(null, oTrans) |