change object properties depending on his moving
First of all I want to apologize for my english, i'm not a native speaker.
I just started to learn maxscript and trying to do simplest things. Thing like that:
I have to objects (for example, sphere and a box). Sphere must change it's radius depending on it's position: if sphere.pos.x < box.pos.x, sphere radius must be equal 5. If sphere.pos.x > box.pos.x, sphere radius must be equal 10. This changes must be displayed in viewport while I move sphere or box in realtime.
Here my script at this moment:
clearlistener() max select All max delete a = Sphere radius:7 b = box length:5 height:5 width:5 pos: [-10, 10, 0] select a !REG3XP1!> if a.pos.x < b.pos.x then ( a.radius = 5.0 ) else ( a.radius = 10.0 ) select a
When I move objects, nothing happened. Tell me, please, what I missed? How code must execute conditional test when object moves?
Comments
*
It's me again. I tried to change sphere visibility now, instead of radius and add second dimension. I change a little a code above, so here it is:
And, of course, it dodn't work. It works with sphere radius, but not visibility. I know that somehow visibility controller must be be bezier_float, but I completly don't know, where exactly i must to set it.
P.S. I know, it may be very stupid question, but I'm very beginner and my knowlege of english as poor as my programming skills, so it's hard to me to read maxhelp quickly, though I trying to do it.
...
Visibility track only have range from 0 to 1.
Why do U need this?
bga
Actually...
my plan was to create a box. When some object (or objects) moved inside this box (I planned to use .min and .max properties), it must become invisible. When object moved out of the box, it must become visible again.
I didn't want to ask to solve exactly this problem at start, because I wanted to figure all out step by step, not to get simple answer at once.
Nope, I cant't understand too
Nope, I cant't understand too many points in this code... Could you explain me this moment, please:
ctrl.AddTarget "bxPos" bx[3][1][1].track
As I understood, this line renurns box position, but why three numbers/indexes? [3] - it's mean position, right? and first [1] - is specified x-position, but the other [1]?
I asked you, because I want to make this script more complex in future. And now I would like to set a relationship between sphere parameters and it's position in relation to box in two or three dimensions.
I would be very grateful if you would find time to answer me.
:)
I showed this 3rd time on this forum. Look this thread
http://www.scriptspot.com/forums/3ds-max/general-scripting/copy-and-past...
bga
of course! transform -
of course!
transform - position - X-axis!
thanks!
Great thanks!!! Now I will
Great thanks!!! Now I will analyse your code, it's always more easily, when you have an example.
...
This is not easy task for beginers but anyway.
I will show you a simple code but you need to read more about controllers and oder stuffs in mxs help.
Also on this forum you can find some interestig threads about that. So
Move box object in X direction to see the result
Cheers!
bga