Define positioning properties from a scene node

Started by Jérémy, July 04, 2018, 01:05:48 AM

Previous topic - Next topic

0 Members and 1 Guest are viewing this topic.

Jérémy

Hi,
I would like to know how to set position, rotation, and scale values from a SceneNode and how to command the reset button ?

I use
T = luxmath.Matrix().makeIdentity().translate(...)
R = luxmath.Matrix().makeIdentity().rotateAroundAxis(...)

but if the first movement is correct for the second I have a gap.
If I click on the reset button and apply the second movement is ok.

I think it's a basic function to set up the position value but i don't find exemple or documentation.
I use the lastest Keyshot pro version 7.3.

It's really important for my work.

Thanks in advance

Morten Kristensen

Hi Jérémy,

In 7.3 you cannot get the transformation matrix, unfortunately. But you can in version 8: each node has a getTransform() that returns a matrix and on that you can call getTransformation() that yields three vectors with the values for: scale, rotation, and translation. The same values you see in KeyShot. Such a transformation matrix can be applied to a node using applyTransform() (this works in 7.3, too!).

Note that even though you cannot get the transformation matrix in 7.3 you can create one if you know the scene and then still be able to do the above application. And resetting is just applying the initial matrix again.

Btw. it plays a role whether you translate and rotate or rotate and translate. The matrix contains scale, rotation, and translation - all in one. So you modify the matrix until it will do what you want it to, then you apply it.

Hope that helps.
Thanks!