You can use the
matrix.preEuler methods to rotate objects relative to arbitrary coordinate frames. Here is how you would roll object1 relative to object2's coordinate frame:
Code:
m = object2.getMatrix()
m.preEuler(0,0,1)
object1.setQuat(m.getQuat())
You would use similar code to perform the rotation relative to the viewpoint by retrieving the matrix from the
viz.MainView object.
Let me know if I misunderstood your question or you need more specific examples.