ScriptSpot

Forum topic · General Scripting

How to acces Key when Attachment controler is under a PositionList?

By UbiGuy · 2011-09-08

Description

Hi!

I try to access attachment controler key in one of my scripts. But It did not work when the Attachment Controler is under a Position List Controler...

Anyone know why??? I'm not a script master and I certainly forget something.

Thank You in advance!

You can try this...

Create 3 cubes: One at the center of your scene (name it PARENT) and two smaller (Name them "A" and "B") Attach "A" to the PARENT with a standard Attachment controler (at Position controler root...) and the "B" with the Attachment controler in second position (in a Position list...).

Now try those command line :

Thekey = attachCtrl.getkey $A.position.controller 1
Thekey = attachCtrl.getkey $B.position.controller[2] 1

and you will get
#ReferenceTarget key(1 @ 0f) for "A"

and

#ReferenceTarget for "B"

Comments (3)

strange...

Anubis · 2011-09-09

If you upload an example simple scene (saved with Max2009 or below) then probably me on someone else can see whats up inside.

Meanwhile read "Value > MAXWrapper > Controllers > PositionController > Attachment Controller Keys" page in the mxs-help. There is an example as well.

Thank You it have solve my

UbiGuy · 2011-09-08

:)

Thank You it have solve my issue!!! The only way to acces attachment controller key is by using controller name???

 

But I get a strange result. Something very weird about Position value.

After passing trought my script the object position in the type-in window is

 x: 100000000.0 y: 100000000.0 z: 100000000.0

And $.pos give to me :

[-1.#IND,-1.#IND,-1.#IND] ( instead of normal coordinate like [-43.2913,3.52432,18.0376] )

If I recreate manually the constraint with the same face# and the same face coordinate I get [-43.2913,3.52432,18.0376] .  I get no error just this strange result.

Maybe I should open a other thread...

here is...

Anubis · 2011-09-08

theKey = AttachCtrl.getKey $B.pos.controller.Attachment.controller 1