Notifications
Clear all

[Closed] editable poly cut made me mad

i just wanted to write a code that acts just like the cut tool i n edit poly modifiers
the help says for that
Interface: EditablePoly[left]
[/left]

[left]<index><EditablePoly>.cutVertices <index>startVertex endPosition viewDirection
[/left]
[left]Cut using a plane defined by the start vertex, the specified point and the view direction.
[/left]

[left]
[/left]
thats so fine but what drove me mad is the direction part i tried to carry out cut by hand and copyng the direction from the listener it works fine but i dont get how exactly to get the direction
i used the method of getting the angle between two verts but in vain feel confused so how to get the direction ?

2 Replies

i just want to know how to calculate the direction correctly so i can have direct cut between the specified two points the direction is point3 i want to know based on what ? is it eulerangles ? or what ?

Hi, a cut is defined by a plane. In the case of the cut tool the plane is defined by a line, drawn between first vertex and a point in space and a direction. For standard cut tool that direction is given by the camera viewing axis. You can get it with the function:

function getViewDir =
(
    return (-(inverse(getViewTM())).row3)
)

It returns a versor (a one unit vector) representing the opposite of the ViewCamera Transform Matrix Z Axis.

  • Enrico