Wire Objects position to anothers vertex

Is it possible to wire an objects position to another objects specific vertex position?

Comments

Comment viewing options

Select your preferred way to display the comments and click "Save settings" to activate your changes.
JokerMartini's picture

rewrite

I had written this
Since getVert is used to get the vert count of both editable mesh and editable poly but it did not work. I'll have to look into it more and see why its not working write.

obj = $Foo ; v = 6
if IsValidNode obj do 
if IsKindOf obj Editable_mesh or IsKindOf obj Editable_Poly and obj.numVerts >= v then
    getVert obj v
else [0, 0, 0]
<code>

John Martini
Digital Artist
http://www.JokerMartini.com (new site)

JokerMartini's picture

Editable Poly

Why no matter what I do this does not work with editable poly?

John Martini
Digital Artist
http://www.JokerMartini.com (new site)

Anubis's picture

quick reply

shortly - modify the expression cause its made for meshes

my recent MAXScripts RSS (archive here)

JokerMartini's picture

This is awesome Anubis.

Thanks Anubis for the help.

However when I just run $Box01.position.controller.update() specifically it errors out saying unknown property in position when using max 2011.

s = Sphere name:"Foo" ; b = Box()
b.position.controller = position_script()
b.position.controller.script = "
obj = $Foo ; v = 6
if IsValidNode obj and \
(getPolygonCount obj)[2] >= v then
    getVert obj.mesh v
else [0, 0, 0]
"
when transform $Foo changes do $Box01.position.controller.update()

John Martini
Digital Artist
http://www.JokerMartini.com (new site)

Anubis's picture

notes...

Hi John,
1st - a little correction needs.

I usually works with collapsed to mesh objects and experiment here to getVert() from TriMesh (.mesh) but that's wrong ;) So, the expression s'd be:

obj = $Foo ; v = 6
if IsValidNode obj and \
IsKindOf obj Editable_mesh and \
obj.numVerts >= v then
    getVert obj v
else [0, 0, 0]

I tested it in Max 2011 as well. Works fine. Remember that Max 2011 use 3 digits enumeration and the name of your Box is not 'Box01' but 'Box001' or 'Box002'.

my recent MAXScripts RSS (archive here)

Graph's picture

thx anubis, cataloged and

thx anubis, cataloged and saved :)
john, once i add this you can do that, might not be today but it shall be awesome ;)

Raphael 'Insanto' Steves
http://Graph.Net84.Net

JokerMartini's picture

Here is an example of what

Here is an example of what I'm trying to do.
I want to populate a plane with objects on every vert of that plane.
When those verts move I want their corresponding objects to move along with that vert.

The reason I'm not using the attachment controller is because it does it based on the center of each polygon face. Although I know i can go in and change the values to 1,-1 or 0,0 to place it on the vert but no matter what i do it leaves me with an empty edge on no objects.

Does that make sense?
That is why I figured it would be easier to possibly through script just link the objects transforms to the individual verts position.

John Martini
Digital Artist
http://www.JokerMartini.com (new site)

Graph's picture

yes i published one for

yes i published one for populating a mesh with copys on the verts but the one brot linked actually links a node to another objs vert
if you wanna link a vert to an obj id suggest some rigging and weighting methods

Raphael 'Insanto' Steves
http://Graph.Net84.Net

Anubis's picture

position_script

example:

s = Sphere name:"Foo" ; b = Box()
b.position.controller = position_script()
b.position.controller.script = "
obj = $Foo ; v = 6
if IsValidNode obj and \
(getPolygonCount obj)[2] >= v then
    getVert obj.mesh v
else [0, 0, 0]
"

my recent MAXScripts RSS (archive here)

JokerMartini's picture

Evalute

Now is there a way to get that to update the the sphere is moved. That way the object will follow that vert. So if i move the sphere or a move that individual vert the box position will update accordingly.

John Martini
Digital Artist
http://www.JokerMartini.com (new site)

Comment viewing options

Select your preferred way to display the comments and click "Save settings" to activate your changes.