[Closed] Need help with maxscript
Hi
I’m just learnig maxscript, so maybe it’s a little bit stupid.
I have created a button using maxscript. When this button is pressed, i want it to switch $Circle01.pos.controller.weight[1] and $Circle01.pos.controller.weight[2]. But i want a smooth transition, using about 25 frames for it.
What i’m trying to do is at frame X (when button is pressed) $Circle01.pos.controller.weight[1]=0 (initial state), and 25 frames later, $Circle01.pos.controller.weight[1]=1
I have used this, but doesn’t work.
button buttonocho “OCHO”
on buttonocho pressed do
(
animate on
(
at time F
$Circle01.pos.controller.weight[1] = 0.01
$Circle01.pos.controller.weight[2] = 0
at time (F+25)
$Circle01.pos.controller.weight[1] = 0
$Circle01.pos.controller.weight[2] = 0.01
)
i think i’m close, but can’t get it. what i’m doing wrong?
thanks in advance
Hi Carlos,
first... try to keep the title of your threads more clear, the "Need help with Maxscript" post in a Maxscript forum doesn't make clear what you are looking for.. maybe somthing like "need help with scripted animation" or something like that would be more clear, as well if you post the error that Maxscript is giving you will help a lot. ( I'm not trying to be rude or mean, just that you'll receive more help that way)
second... try this, maybe it will work:
rollout param "parameters" width:205 height:272
(
button buttonocho "OCHO"
on buttonocho pressed do (
animate on
F = currentTime
(
at time F (
$Circle01.pos.controller.weight[1] = 0.01
$Circle01.pos.controller.weight[2] = 0
) --end at time F
at time (F+25) (
$Circle01.pos.controller.weight[1] = 0
$Circle01.pos.controller.weight[2] = 0.01
) --end at time F+25
) --end animate on
) --end on buttonocho
)
-- Comprueba que no existe el rollout, si existe lo cierra antes de abrir
if UnScript != undefined then closeRolloutFloater UnScript
UnScript = newRolloutFloater "biped_placer" 170 130
addrollout param UnScript
Hi Fabian
I was goint to change my post’s tittle when i saw your answer.
I’m going to check it, and will tell you.
Gracias.
No problem Carlos, I guess that should work, but I haven’t testest that with weighted objects, so if you got any error post it and I’ll modify the scritp. You’re using a position constraint, isn’t it?.
De nada.
Hello Carlos,
try this one better, it lets you change the values through spinners, and works over the current selected object.
rollout param "parameters" width:205 height:272
(
button buttonocho "OCHO"
spinner maxVal "maxValue" type:#float
spinner minVal "minValue" type:#float
spinner incFrames "incFrames" type:#integer
on buttonocho pressed do (
for obj in selection do (
F = currentTime
animate on
(
at time F (
obj.pos.controller.weight[1] = maxVal.value
obj.pos.controller.weight[2] = minVal.value
) --end at time F
at time (F+incFrames.value) (
obj.pos.controller.weight[1] = minVal.value
obj.pos.controller.weight[2] = maxVal.value
) --end at time F+25
) --end animate on
) --end for obj
) --end on buttonocho
)
-- Comprueba que no existe el rollout, si existe lo cierra antes de abrir
if UnScript != undefined then closeRolloutFloater UnScript
UnScript = newRolloutFloater "biped_placer" 170 130
addrollout param UnScript