Announcement

Collapse
No announcement yet.

Generate multiple cameras at position of vertices with Maxscript.

Collapse
X
 
  • Filter
  • Time
  • Show
Clear All
new posts

  • Generate multiple cameras at position of vertices with Maxscript.

    I would like for multiple cameras to be generated automatically with maxscript: For instance I would like to have a hemisphere around a product that I want multiple shots of and I want the cameras to be generated at the position of the vertices. Ideally the target of the camera is the center of the hemisphere or even better another object of choice. Even more ideally, is that the cameras are linked to the position of these vertices, so when I deform the hemisphere in any way, the cameras are following along. I've been looking around but haven't found anything that could help me. If someone could help me in the right direction, that would be great. Thank you.
    A.

    ---------------------
    www.digitaltwins.be

  • #2
    You can try with this function:

    Code:
    fn attachToVertices targetSurface source = (
    
        max create mode
    
        targetMesh = targetSurface.mesh
    
        usedVertices = #()
        coords = #([1, 0], [0, 1], [0, 0])
    
        for faceIndex = 1 to targetMesh.numFaces do (
            face = getFace targetMesh faceIndex
            for i = 1 to 3 do (
                vertexIndex = face[i]
                if appendIfUnique usedVertices vertexIndex do (
                    maxOps.CloneNodes source cloneType:#copy newNodes:&result
    
                    attachmentController = Attachment()
                    attachmentController.node = targetSurface
    
                    result[1].position.controller = attachmentController
                    addNewKey attachmentController 0f
                    newKey = AttachCtrl.getKey attachmentController 1
                    newKey.face = faceIndex - 1
                    newKey.coord = coords[i]
                )
            )
        )
    )
    The first parameter is the object you want to attach to and the second the one you want to clone attached to the vertices, for instance a camera.

    Comment


    • #3
      Thank you! I tried but I'm not getting anything. Is there something specific I need to do?
      A.

      ---------------------
      www.digitaltwins.be

      Comment


      • #4
        It's a long shot, as I know nothing of Maxscript coding - but couldn't this maybe be repurposed to do this?
        http://www.scriptspot.com/3ds-max/scripts/dome-light
        https://www.behance.net/bartgelin

        Comment


        • #5
          It's a start indeed. But I just found this and this does exactly what I need and it stays intelligent, if I deform the object the cameras move with it: http://www.scriptspot.com/3ds-max/sc...ct-to-vertices

          Thanks for your help guys!
          A.

          ---------------------
          www.digitaltwins.be

          Comment


          • #6
            Originally posted by Vizioen View Post
            Thank you! I tried but I'm not getting anything. Is there something specific I need to do?
            The script that Codi have posted will create a function that you can call for any objects later
            so after excution the above maxscript you can type the following for example :

            Code:
            attachToVertices $Sphere001 $Camera001
            and hit enter from the Numpad Regards,
            -------------------------------------------------------------
            Simply, I love to put pixels together! Sounds easy right : ))
            Sketchbook-1 /Sketchbook-2 / Behance / Facebook

            Comment


            • #7
              Oh well, good you found another way. As M.Max said, you have to call the function with the name of the objects you want to use for it to run.

              Comment

              Working...
              X