Hi Mati,
I think I`ve found why my own camera manipulator does not work… the omni.kit.viewport.window-extension does access the camera manipulator extension directly (have a look at camera.py line 31).
But when I just copy the camera manipulator extension and load that too, I get a warning but “my” extension is used… so far so good.
But to be honest my python / 3D-math skills are to limited to get this working. Here is what I’ve got so far:
I’ve changed the code in gesturebase.py for _accumulate_values like this:
def _accumulate_values(self, key: str, x: float, y: float, z: float):
item = _accumulate_values(self.model, key, x, y, z)
if item:
last_transform = self.last_transform
position = last_transform.ExtractTranslation()
rotation = last_transform.ExtractRotation()
if (position[1] < 0):
position[1] = 0
xxx = last_transform.SetTranslate(position)
#xxx = last_transform.SetLookAt(position, self.center_of_interest, Gf.Vec3d(0, 1, 0))
data = [xxx[0][0], xxx[0][1], xxx[0][2], xxx[0][3], xxx[1][0], xxx[1][1], xxx[1][2], xxx[1][3], xxx[2][0], xxx[2][1], xxx[2][2], xxx[2][3], xxx[3][0], xxx[3][1], xxx[3][2], xxx[3][3]]
self.model.set_floats('transform', data)
self.model._item_changed(None if self.__keyboard else item)
My “goal” here was to prevent to camera to be moved below the plane (y < 0)… but I have ne clue how to override the transform matrix here. Can you help?
Thanks
Carl