Announcement

Collapse
No announcement yet.

Constraining an object to a path

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

  • Constraining an object to a path

    Currently stuck on one of those problems that seems simple but I can't get my head around.

    I have an object following a path using a Path Constraint controller, however I would like the percentage that it follows that path to be dictated by the transform of another object.

    Basically, I want an object to follow the motion of another object but never veer of it's own pre-determined path. I had hoped that linking *might* magically work in conjunction with the Path Constraint but I was wrong & Max laughed at me.

    Does anyone have any ideas or pointers that might help achieve this?

    Thanks!
    MDI Digital
    moonjam

  • #2
    Might be able to do that with the reaction manager...
    Cheers,
    -dave
    ■ ASUS ROG STRIX X399-E - 1950X ■ ASUS ROG STRIX X399-E - 2990WX ■ ASUS PRIME X399 - 2990WX ■ GIGABYTE AORUS X399 - 2990WX ■ ASUS Maximus Extreme XI with i9-9900k ■

    Comment


    • #3
      PointCache the object following the path and then parameter wire it's % playback to the object its following...?
      regards
      steve blake - animator - designer
      www.stevenblakedesign.co.uk

      Comment


      • #4
        Thanks for the replies.

        Unfortunately the objects are helpers controlling other objects so point cache isn't an option. Also, the reaction manager doesn't really allow for what I want.

        I've got a feeling I'm going to need to script it but I always start crying when it comes to scripting splines/paths
        MDI Digital
        moonjam

        Comment


        • #5
          Not very clean but somehow it does sound like you could to bake some of these keys, then go back and layer (parent or constrain) helpers back on top ...maybe?
          regards
          steve blake - animator - designer
          www.stevenblakedesign.co.uk

          Comment


          • #6
            Yeah, I'd drop a float script controller in the percentage property of your path animated object. Open to helping figure it out if you post more details, a bit vague at this point to get into specifics much.
            | LinkedIn | Twitter | JCanimator.com |

            Comment


            • #7
              You need a look at constraint I would imagine...

              So:

              Patch > Dummy follow patch > position constraing ur object to dummy. Then use look at constraint to specify rotation of ur objects. This way you can control your rotation and position independently.
              CGI - Freelancer - Available for work

              www.dariuszmakowski.com - come and look

              Comment


              • #8
                Ok, I've animated a GIF of what I'm trying to achieve, I keyframed this manually so it's not perfect but hopefully gets across what I ideally want.



                I want the yellow helper to move freely and the green helper(s) to do their best to follow it but stay constrained to their paths. The more I think about this the more I worry it's going to be quite a complicated job, in terms of calculating proximity and translating transforms to the path percentage.
                Last edited by AJ Jefferies; 31-07-2014, 02:42 AM.
                MDI Digital
                moonjam

                Comment


                • #9
                  Challenge accepted. A bit under the gun today but will see what I can scrape together. I know there's a couple maxscript commands / spline functions that should get a lot of it there without too much heavy lifting...i think... stay tuned.

                  Edit: Okay that was ridiculously easier than I expected, it's a single command: nearestPathParam - Description from the MAXScript Help - Return the interpolation parameter value (0.0 to 1.0) corresponding to the point along the curve that is closest to the given <point3> coordinate. The parameter is given as a 3ds MaxPath (vertex-based) interpolation parameter value.

                  Max 2014 scene setup attached, here's how you do it -
                  Go to each object that is path constrained, change the percent controller to a float script.
                  Inside the float script create two variables - one for the path it's constrained to and one for the target point helper you want to control, name it whatever you want but you'll have to use that name in the next step.
                  The script to evaluate would be: nearestPathParam pathVariableName (targetVariableName.pos)

                  You could harcode the object names instead of creating variables, but then you'd have to add a DependsOn <obj> line because the controller wouldn't know to re-evaluate when your control object moves.
                  Attached Files
                  Last edited by SnipeyX; 31-07-2014, 10:33 AM.
                  | LinkedIn | Twitter | JCanimator.com |

                  Comment


                  • #10
                    That's absolutely perfect - thank you so much for this, it's a huge help!
                    MDI Digital
                    moonjam

                    Comment

                    Working...
                    X