# SetObjectVisualTransform

Can anyone provide a definitive guide to the precise definition of the x- y- and z-axes when used with this function?

The Lexicon tells us “changes are relative to the given objects facing and current position”.

There seems to be some truth in that. When an object is facing 0.0, x-translation is along the area x-axis, but when the facing is 90.0, the same x-translation is along the area y-axis.

Rotation is also odd. For example, to change the apparent facing, it seems to be x-rotation rather than z-rotation?

No doubt I could figure it out, but no need if anyone has already?

Alternatively, does anyone have a wrapper that visually transforms an object to a target location, regardless of actual facing?

Non-definitive, they’re model root coordinates, not world coordinates. So in simple case (i.e. ignore held item or multiple part model), multiply x by cos of facing angle and y by the sin.

Kamiryn posted a wonderful NUI example module for unrelated bugtesting on nwnx discord to check out.

1 Like

Thanks.

I don’t think nwnx works for SP, but I can probably figure out my own function.

Don’t know if it’s wonderful… it’s just me taking some steps into NUI world .

It’s some kind of nui interface for SetObjectVisualTransform(), it’s on nwnx discord because v35 is there but it doesn’t use nwnx. Nothing someone with a bit of experience in nwscript/nui could not do .

One thing I discovered for myself when I created the animated starry sky for the January 2022 CCC. For any rotation about a given axis, the angle is absolute. By this I mean that if you rotate by 30 degrees about say the X-axis and tell it to rotate by another 30 degrees, nothing will happen. The rotation is with respect to the original direction before applying SetObjectVisualTransform(). It is not cumulative so to obtain that 30 + 30 degrees, you will need to pass it 60 degrees.

TR

True. My impression is that the Visual Transform script works exactly the same as Adjust Location in the toolset. If true, you can only have one absolute value for a given transform e.g. there’s only one toolset box for the x-rotation, so entering 30 in that box, then entering 30 again, obviously equals 30. Enter 60, the result is 60. Likewise translation.