Keep 3DLuVr online!
3DLuVr Logo
Sections
Articles
 From the Real World
 Digital Painting Series
 Featuring of...
 On the Bookshelf
Tutorials
 3ds max
 LightWave3D
 Softimage XSI
 Rhinoceros 3D
 Video Tutorials
FunZone menu
 I always wanted to be
 Talk to an employer
 Why Ask "Why"
TechZone menu
 Hardware Reviews
 Software Reviews
 Benchmarking
 Q&A, Tips & Tricks
UserZone menu
 The Artist Sites
 15 Min of Fame
 Request an Account
 Current Assignment
 Sponsors & Prizes
 Make a Submission
 Voting Booth
 Competition Rules
About menu
 Mission Statement
 Policies
 Advertising
 Comments
 Poll Archive
 Links
 How to IRC
 Donations
Login
Log in to be able to post comments to the news items, forum posts, and other facilities.
Username: 
 
Password: 
Not registered? Register!     Lost Password?
Poll
 Your New Year`s Resolution is...
Gain employment
Stop smoking/drinking/etc
Get back in shape
Find the meaning of life
Conquer the World
Absolutely nothing

    Poll Results
Comments
Want to leave us a comment about the site or in general? Click here to access the form.
ArtZone Heading
Link Object to a Vertex
Added on: Mon Aug 14 2000
Page: 1 2 3 4 5 6 7 8 10 

Now for the final button. Type:
    on LinkME_button pressed do (

    Child_Obj.position.controller = position_script()
    Child_Obj.position.controller.script = "getvert parentOBJ vertnum"

    ) --close on LinkMe
This has the same button syntax as the first one we did and it only has two additional lines of script. The first line changes the child_obj's position controller. Animatable objects have controllers and we want the controller to use MAXScript.
So we assign the position_script controller to the child_Obj by typing "Child_Obj.position.controller = position_script()" Other info you can get out of an object is.
Object.name - its name like teapot01
Object.pos - its current position (0,0,0)
Object.controller - its main controller ie) look at, PRS, Link
Object.rotation.controller - the rotation controller Look though the help file. You will get tons of info from it.

The last line of text assigns the "mini-script" to the child_obj's position script controller.
The function getvert takes two parameters. The first is the object with the vertex.
The second is the vertex number. The function returns the position of that vertex.
This position is what the scriptable controller uses.

SO....this is what you should have now.
    MainFloater = NewRolloutFloater "Link To Vertex" 300 315

    Rollout Vert_Linker "Vertex Linker" (

    group "Pick Vert" (

    Label getvert1L "Select a vertex to be parent"
    Label getvert2L "then hit 'Get Selected Vert'"
    Button GetVert_Button "Get Selected Vert"
    Label vertnumL "Vertex Number: (none selected)"

    ) -- close group

    group "Pick Child" (

    Label childL "Select Child Object"
    PickButton GetChild_PB "Get Child"
    Label childnameL "Child Object: (none)"

    ) -- close group

    group "Link ME Plz!" (

    Button LinkME_Button "Link ME!" enabled:off

    ) --close group

    -----------------------------------------------------------------------------
    on GetVert_Button pressed do (

    parentOBJ = $
    vertnum = (getvertselection parentOBJ)[1]
    vertnumL.text = "Vertex Number: " + (vertnum as string)
    VertPicked = true
    if ChildPicked == true do LinkME_Button.enabled = on

    ) -- close on getvert
    -----------------------------------------------------------------------------
    on GetChild_PB picked obj do (

    Child_Obj = obj
    childnameL.text = "Child Object: " + Child_Obj.name
    ChildPicked = true
    if VertPicked == true do LinkME_button.enabled = on

    ) --close on getchild
    -----------------------------------------------------------------------------
    on LinkME_button pressed do (

    Child_Obj.position.controller = position_script()
    Child_Obj.position.controller.script = "getvert parentOBJ vertnum"

    ) --close on linkme

    ) -- Close Rollout

    addRollout Vert_Linker MainFloater -- Add Rollout to the main floater



 
1997-2017 3DLuVrTM (Three Dee Lover)
Best viewed in 1024x768 or higher,
using any modern CSS compliant browser.