Xaimav
07-22-2009, 08:26 PM
Hi, my problem seem simple but i've tried at least 10 ways to do it that don't work and I can't find a thread addressing this issue.
I'm using 3dsMax 8 to make a utility script that have 3 spinner boxes :
spnObjectPosX
spnObjectPosY
spnObjectPosZ
To make things simple, I have only 1 rectangle shape in my scene and this is how I set a CALLBACK on it :
when transform $ changes object do update_panel_object_data_transform object
Note that the function receive the object in parameter.
Here is my callback function :
fn update_data_transform object =
(
spnObjectPosX.value = object.position.x
spnObjectPosY.value = object.position.y
spnObjectPosZ.value = object.position.z
)
I have to tell you that the X axis is working fine! BUT NOT THE Y AND Z?!?
Here is my observations of what happen :
1- Assume that my object is at the center of the world [0,0,0]
2- When I move the object with the gizmo on the X axis the spnObjectPosX is changing to show the current position of the object and everything is working fine.
3- The problem : when I move the object with the gizmo on the Y axis, the spnObjectPosY is showing the position from wich I start moving (in our case 0) and NOT the current position. Moreover, I can see the value of the spinner "flicking" with the good value! But it is always set back to the "starting position" (in our case 0)
4- The same problem occur on the Z axis.
5- If I move the object on the X axis after moving it on the Y axis, the spnObjectPosY suddenly get updated with the right Y value!
So whats happening, why the object.position.y is returning the origin value while I move the object with the gizmo?? Is it a bug of 3dsmax or am I just not using it the right way.
Any advice would be greatly appreciated.
I'm using 3dsMax 8 to make a utility script that have 3 spinner boxes :
spnObjectPosX
spnObjectPosY
spnObjectPosZ
To make things simple, I have only 1 rectangle shape in my scene and this is how I set a CALLBACK on it :
when transform $ changes object do update_panel_object_data_transform object
Note that the function receive the object in parameter.
Here is my callback function :
fn update_data_transform object =
(
spnObjectPosX.value = object.position.x
spnObjectPosY.value = object.position.y
spnObjectPosZ.value = object.position.z
)
I have to tell you that the X axis is working fine! BUT NOT THE Y AND Z?!?
Here is my observations of what happen :
1- Assume that my object is at the center of the world [0,0,0]
2- When I move the object with the gizmo on the X axis the spnObjectPosX is changing to show the current position of the object and everything is working fine.
3- The problem : when I move the object with the gizmo on the Y axis, the spnObjectPosY is showing the position from wich I start moving (in our case 0) and NOT the current position. Moreover, I can see the value of the spinner "flicking" with the good value! But it is always set back to the "starting position" (in our case 0)
4- The same problem occur on the Z axis.
5- If I move the object on the X axis after moving it on the Y axis, the spnObjectPosY suddenly get updated with the right Y value!
So whats happening, why the object.position.y is returning the origin value while I move the object with the gizmo?? Is it a bug of 3dsmax or am I just not using it the right way.
Any advice would be greatly appreciated.
