Home Technical Talk

Q MAXSCRIPT : Local vertex rotation data

polycounter lvl 15
Offline / Send Message
leslievdb polycounter lvl 15
i would like to know how i can retrieve the local rotation parameters from a vertex in maxscript.

157y7et.jpg

Replies

  • MoP
    Offline / Send Message
    MoP polycounter lvl 18
    If by "rotation" you mean "average normal" then this should be fairly easy to determine.

    A vertex on its own has no inherent "rotation" as such...
  • leslievdb
    Offline / Send Message
    leslievdb polycounter lvl 15
    Is there a difference in average normal and normal or is it the same ?

    does that normal correspondent with the direction the z axis is pointing at in the example (i am looking for that direction)?

    i currently calculate my normals by using this method, but it doesn`t seem to be doing the trick

    fn GetVertNormal obj vert =
    (
    vertFaces = polyOp.getFacesUsingVert obj vert
    tNormal = [0,0,0]; for i in vertFaces do tNormal += polyOp.getFaceNormal obj i
    tNormal / vertFaces.numberSet
    print tNormal
    return (tNormal)
    )
  • PolyHertz
    Offline / Send Message
    PolyHertz polycount lvl 666
    The 'normal' of a vertex is simply the averaged normals of the surrounding faces. Get the verts connected faces, then use the polyop.getFaceNormal function for each and average to get the normal.

    Maybe something like this:

    vrtNum = (polyOp.getVertSelection $.baseObject) as array
    vrtFacs = (polyop.getFacesUsingVert $ vrtNum) as array
    vNormal = [0,0,0]
    for vf in vrtFacs do (vNormal = (polyop.getFaceNormal $.baseObject vf) + vNormal)
    tNormal = vNormal / vrtFacs.count


    It could also help to know what your trying to do with this.
  • leslievdb
    Offline / Send Message
    leslievdb polycounter lvl 15
    tnx polyhertz , seems to me that the problem is somewhere else in the code but i think i`ll be able to find it ^^

    i`m working on a wrapmode (lowpoly wrapping around highpoly) for a tool that i am making btw )
Sign In or Register to comment.