Home Technical Talk

MEL question

polycounter lvl 19
Offline / Send Message
Brice Vandemoortele polycounter lvl 19
Hello everyone
I'll explain the whole problem just in case I'm just thinking wrong ^^ but essentially i'd like to fetch the tangent basis of vertex (in world space)

So I'm building race tracks using a 'straight' mesh that i bend using a Flow path along an EP curve. I need to parametrize that track using a serie of transform, aligned with the track. Unfortunately it seems the flow path (a lattice) only deforms geometry, and not object's transforms.
So the solution I was think was to:
- create a bunch of quads, perpendicular to the track,
- bend them the same way and then
- match transforms with the orientation of the bended quads

I need to query the 'local transform' of one of the vertex of one of this quad, and align a locator with it. How would you do that? Thanks in advance :)

(Unless i can actually snap locators to an EP curve, including its rotation?)

Replies

  • Xoliul
    Offline / Send Message
    Xoliul polycounter lvl 16
    Don't you have something like Path constraint in Max ? Sounds like that is what you'd need, if i'm not mistaken ?
  • PolyHertz
    Offline / Send Message
    PolyHertz polycount lvl 666
    Maybe I'm reading this wrong, but sounds like a job for the xform command, as far as the transform is concerned.
  • MoP
    Offline / Send Message
    MoP polycounter lvl 18
    Yeah if you want to just get a point in space at any given time, just use:
    float $pos[] = `xform -q -a -ws -t myMeshNode.vtx[1]`;
    

    This would query the absolute worldspace location of vertex index 1 on an object called "myMeshNode".

    However if you want to actually lock the position and "constrain" the locator to the vertex then you're going to have to start using more complicated stuff like a node that returns pointOnSurfaceInfo.
  • ivars
    Offline / Send Message
    ivars polycounter lvl 17
    (Unless i can actually snap locators to an EP curve, including its rotation?)

    Could you use a motion path with follow activated?
  • Brice Vandemoortele
    Offline / Send Message
    Brice Vandemoortele polycounter lvl 19
    Hi everyone, thanks for all your advices :)

    @ivars: indeed, motion path does the trick, but i don't really grasp how i could code that to be automatic, the whole 'related to timeslider' thing is pretty annoying. I'd love to hear a solution using this tough.

    The über function would be a version of 'Modify > Snap Align Object > Position Along Curve' that supports orientation along the curve too, and not just position.

    @ PolyHertz , Mop I had a look at the xform command and I don't see how i can fetch the normal, tangent or bitangent of my vertex. All I can fetch is a matrix, and I'm not really sure what to do with that afterward...

    I checked further and realized something pretty easy:
    create the initial quads (i0,i1,..) duplicate the quads and bend the copy (d0,d1,d2,..) make a loop that iterate trough every quad, select the first 3 vertices of both initial and deformed, and then run a "Snap Align Objects > 3 Points to 3 Points".

    But of course, the only function i know so far that has no MEL equivalent is this one.... the script editor outputs only a bunch of 'rotate' with values precalculated 'somewhere' (WTF! sorry, it had to get out...)

    any workaround ?


    edit: my bad 'pointOnSurface' gives me back the tangent basis, now i need to figure out how to align a transform with it
  • Brice Vandemoortele
    Offline / Send Message
    Brice Vandemoortele polycounter lvl 19
    ok, pointOnSurface only works for NURBS, but it ended up to be more easy to work with the initial curve than with deformed quads. just using 'pointOnCurve' gives me everything i need to create a matrix that I input to the xform command. done :)
    thx everyone
Sign In or Register to comment.