[vtkusers] Where is the actors matrix being saved?

David Doria daviddoria+vtk at gmail.com
Sun Sep 5 11:33:57 EDT 2010


Hi all,

I am trying to demonstrate how to control a "piece" in a "game" (if
one were to want to make a checkers game using VTK, for example).

http://www.vtk.org/Wiki/VTK/Examples/Cxx/Broken/Interaction/Game

The idea is as follows:

Using the middle mouse button, move the cube so that a corner of the
cube is inside of the sphere. When you release the middle button in
this position, the program outputs "the cube is inside of the sphere"
and resets the cube to its original position (by setting the actor's
matrix to identity). This part works properly.

The problem is, when I try to do this a second time, as soon as I
start to move the cube, it jumps back to its ending position from the
last iteration! I can't figure out where this old transformation is
being stored - I thought calling:

CubeActor->GetMatrix()->Identity();

would reset the actors position (and it does), but it seems like it is
saved somewhere else as well and re-applied the next time the cube is
selected.

Anyone have any ideas?

Thanks!

David



More information about the vtkusers mailing list