Community
VRED Forum
Welcome to Autodesk’s VRED Forums. Share your knowledge, ask questions, and explore popular VRED topics.
cancel
Showing results for 
Show  only  | Search instead for 
Did you mean: 

Overriding a viewpoints eulerRotation by Fieldaccess doesn't Refresh values.

5 REPLIES 5
SOLVED
Reply
Message 1 of 6
Anonymous
668 Views, 5 Replies

Overriding a viewpoints eulerRotation by Fieldaccess doesn't Refresh values.

 

Hello,

 

a viewpoints eulerRotation override does not refresh.

 

vp_node.fields().setVec3f("eulerRotation", angles[0],angles[1],angles[2])

selectViewPoint(vp_name)

 

The values are overridden when I open the Nodeeditor, but even if I manually select the viewpoint, the view doesn't change.

Doing the same with "translation", works

 

overriding the matrix doesn't work either.

 

I'm using 2017.2. Is that a bug or do I have to trigger something?

 

Thank you for any help

5 REPLIES 5
Message 2 of 6
sinje_thiedemann
in reply to: Anonymous

Hi,

 

for changing the transformation of a transform node (which a viewpoint is) I'd suggest using the functions from vrNodeUtils, in this case setTransformNodeRotation:

 

setTransformNodeRotation (vp_node, angles[0],angles[1],angles[2])

 

Best regards

Sinje

Message 3 of 6

A quick explanation on this: The euler and quaternion rotation values must be in sync. This is not the case if you set them by vrFieldAccess and it can be tricky to try this on your own.



Michael Nikelsky
Sr. Principal Engineer
Message 4 of 6
Anonymous
in reply to: sinje_thiedemann

oh that was ways easier as expected. Thank you very much.

 

I guess I should prevent modifying node fields/properties through field access as often as possible. Its however strange that my approach worked for the translation part, but not for the angles. Just out of curiosity, does this mean, field access is only a very raw tool to modify data but without any mechanism to force an update on that specific field? How can I force updates then? Is this possible through Field access, or does it highly depend on the mechanism behind and differs from field to field. Such errors are actually very hard to debug, if you change fields, the numbers are changed, you even activate that object, but the result is still different.  It took me some time to actually identify the problem. 

Another question, Is there something like autocomplete/intellisense planned for VRed?  

 

 

Message 5 of 6
Anonymous
in reply to: michael_nikelsky

thank you, that answered some questions...

Message 6 of 6
michael_nikelsky
in reply to: Anonymous

Yes, vrFieldAccess is as low level as it gets. It allows you to change any values of a fieldContainer but it also makes you responsible for the values to make sense. There are some sanity checks on some values but in this case the transformation is valid, it just doesn´t match the quaternion (that´s why it works for translations, those are just simple values that don´t have any dependencies). It would probably have worked if you had modified the quaternion since this is the value used for calculating the matrix (euler are basically nothing more but an artist friendly representation of a rotation but for the actual math quaternions are far superior since the don´t suffer from things like gimbal lock and it is also possible to interpolate between two rotations without doing something weird like euler often do).

In general, I would avoid the FieldAccess as long as there are other functions that can do the job.

 

There are currently no plans to have something like intellisense. I would recommend to use a third party editor and write your code as a script plugin.



Michael Nikelsky
Sr. Principal Engineer

Can't find what you're looking for? Ask the community or share your knowledge.

Post to forums  

Autodesk Design & Make Report