[Closed] Drive position via array?
Hi, I’m somewhat new to MaxScript but I’ve been Poly Modeling for a while now…
I’ve been writing a few basic scripts to get my head around what you can do (or what I can do at least) in MaxScript…
Ok I’m trying to move the position of a Dummy via an array of integers but as I’m so new to this I can’t quite figure out how to link the position of the dummy to the array, I’ll also have to key frame each movement so I can at least see if this works, I don’t want it all to happen in one frame after all…
Below is the script for the dummy positioner I’ve made so far… remember, I’m literaly 2 days new to MaxSxript so please have mercy on my soul.
macroscript Run_Positioner
category: “Positioner”
(
function Run_Positioner = (
Positioner = Dummy name:"positioner*"
Positioner.position = [0,0,0]
PositionArray = #(0,5,10,15,20,25,30,35,40,45,50)
For i in PositionArray do Positioner.pos.z == PositionArray
)
Run_Positioner()
)
macroscript Delete_Positioner
category:“Positioner”
(
delete $Positioner*
)
Also if you’re feeling generous, I’ve figured out how to create an object, change it to an editable poly and select faces but I can’t seem to extrude the face, is there a straight forward code for this? I ask as I’m making a kind of “different” tree grower script based on the one in the CG Society DVD “understanding the Matrix”… They’re good DVD’s but I feel I’ve spent £70+ to be shown where the MaxScript Refference window is…
Many thanks and please ask for more details if you wish.
OK there are a few basics you got wrong in your script, I would say you need to read a bit about the “for loop” for a start!
anyway here is a way of doing it, at least you can see how it can be done.
rollout test "Test"
(
button btnMove "Press to Move" align:#center
local posArray = #(0,5,10,15,20,25,30)
local newpos
on btnMove pressed do
(
slidertime = 0
with animate on -- just so it sets some keys
for i = 1 to posArray.count do -- run through the array counting from 1 (as all arrays count from 1)
(
newPosX = posArray[i] -- create a new variable so we can implement it
newPosY = $box01.pos.y
newPosZ = $box01.pos.z
newPos = point3 (newPosX) (newPosY) (newPosZ) -- combine the position values
in coordsys world $box01.pos = newPos -- apply the new position co-ordinates
slidertime += 1
)
)
)
createDialog test 200 100
I animated it moving along so you can see the results of it creating your animation.
Dunno about the modelling side of script, but I would grab something similar to what you want to achieve and study, and read the max reference its pretty good.
saying that, you could just do –
for i = 1 to posArray.count do
(
$box01.pos.x = posArray[i]
slidertime += 1
)
Thanks a lot for the reply simonpapp, I’m so very new to this MaxScript business but your help is greatly appreciated.