Hi,
To achieve it, you can multiply locator transforms on
M3dView.modelViewMatrix().inverse()
I use the following to keep my MPxManipulatorNode (circle) oriented on
camera (partial copy/paste from draw() method) It's c# but on python
workflow the same.
public override void draw(M3dView view, MDagPath path,
M3dView.DisplayStyle style, M3dView.DisplayStatus status)
{
.....
MMatrix modelViewMatrix = new MMatrix();
view.modelViewMatrix(modelViewMatrix);
.....
OpenGL.glLineWidth(3);
OpenGL.glBegin(type);
for (double i = 0; i < 2 * M_PI; i += M_PI / CIRCLE_SIDES_NUM)
{
MPoint circlePoint = new MPoint(Math.Cos(i) * radius,
Math.Sin(i) * radius, 0.0);
MVector circlePointVector = new MVector(circlePoint);
circlePointVector =
circlePointVector.multiply(modelViewMatrix.inverse);
OpenGL.glVertex3d(circlePointVector.x + center.x,
circlePointVector.y + center.y, circlePointVector.z + center.z);
}
OpenGL.glEnd();
}
I hope this will help.
Best Regards,
Serge Scherbakov
среда, 22 января 2014 г., 13:55:14 UTC+4 пользователь Dilen Shah написал:
>
> Hey guys,
>
> I am trying to learn how to create a shape that always faces the camera. I
> have created before a locator which has its name facing the camera always
> but how can i do it with the whole shape itself?
>
> Any ideas?
>
> D.
>
--
You received this message because you are subscribed to the Google Groups
"Python Programming for Autodesk Maya" group.
To unsubscribe from this group and stop receiving emails from it, send an email
to [email protected].
To view this discussion on the web visit
https://groups.google.com/d/msgid/python_inside_maya/cfb9c901-4c50-47a0-9fe9-ff1271faf5db%40googlegroups.com.
For more options, visit https://groups.google.com/groups/opt_out.