PDA

View Full Version : easy question


mrfred
03-21-2012, 02:51 PM
I'm kinda new to maxscript and i'm stumbling upon something that should be quite easy.

I'm trying to place a zero position XYZ X axis into a variable

I can move it use those 2 lines

t =$Teapot001
at time 100 animate on t.pos.controller.Zero_Pos_XYZ.controller.X_Position = 200

but I what i'd like to do is to place the t.pos.controller.Zero_Pos_XYZ.controller.X_Position into a variable but I cant do it

What am I missing? :blush:

mrfred
03-21-2012, 07:21 PM
nvm that
got it working using
tbc = t.pos.controller.Zero_Pos_XYZ.controller[1].controller

jforrester
03-21-2012, 09:27 PM
Fairly new to maxscript myself, so I hope this helps.

Copy ALL of the code below. Obviously you need an object named Teapot001 in the scene

/*The below varibles hold the Teapots current position in x,y,z */
currentX = t.pos.x
currentY = t.pos.y
currentZ = t.pos.z

/*Replace any of the below values after the = sign with currentX, currentY, currentZ above to leave that value alone i.e "y = currentY"*/
x= 0
y = 0
z = 0

t =$Teapot001
t.position = [x,y,z]

DaveWortley
03-21-2012, 10:25 PM
Position is a Point 3, xyz value so expects 3 numbers in brackets such as:
[0,0,0]
[10,10,10]
[-10,20,30]
with animate on at time 100 do $Teapot001.pos = [0,0,0]

jforrester
03-21-2012, 10:43 PM
Thats strange. I know what you mean about entering numerical values only, but to keep the current x,y or z I simply used the currentX variable above and it worked fine.

Maybe there is a better way to leave current x,y,z positions intact, like I say I'm still quite new to it myself.

DaveWortley
03-21-2012, 10:55 PM
[0,0,0] is a point 3 value so you can access values individually too

a = [0,0,0]
a.x = 1
[1,0,0]

with animate on at time 100 do $Teapot001.pos.x = 1

mrfred
03-22-2012, 12:14 PM
thanks for all the answer ... although I used
tbc = t.pos.controller.Zero_Pos_XYZ.controller[1].controller

to get results

CGTalk Moderation
03-22-2012, 12:14 PM
This thread has been automatically closed as it remained inactive for 12 months. If you wish to continue the discussion, please create a new thread in the appropriate forum.