Mailing List
Home
Forum Home
Softimage
Carrara
trueSpace
Dir3d-l
Maya - a powerful 3D animation and visual effects software
Macromedia Flash Development
Subjects
Cameras
scaleDown command
black out solved
Aircraft Tutorial
Mathematical XYZ ?
Its done This vs That
Its done first week
recommendations for screen video captures?
3DExplorer "Oddity "
New Director
ProTeam renewals
Fuel 's new websites (X post)
Blue peter create a make toy
targeting groups question
XPost: Shockwave 3D game ( sort of )
RES: RES: RES: Fish Modeling
Emitting particles from object intersection
Fuel 's new websites (X post)
Texturing
Big Break Contest Videos
New Plugins
Models and Texture on my updated site
Error Installing Patch tS6 6
Plasma?
Looking for Inspiration
Weird EMail Q
It 's done first week ?
Cherry not cranberry
New game
Camera Animation Problem
Particle plugins?
 
MPxConstraint (or lack of)

MPxConstraint (or lack of)

2003-11-27       - By deane@(protected)

 Back
Reply:     1     2     3     4  

On Mon, Nov 24, 2003 at 09:43:08PM +0100, Olivier Renouard wrote:
>
> How would you implement a custom constraint? I wish there would be some
> MPxConstraint class so custom constraints would inherit basic constraint
> behaviors, for now I'm relying on basic dependency nodes.

Note that constraints are generally derived from MPxTransform, not MPxNode,
but there's really nothing to stop you from deriving directly from MPxNode
if you don't need any of the extras that MPxTransform provides.

> Particularly it seems to be hard to replicate constraints like the
> geometry constraint that still allow the constrained object to be moved
> within the constraint validity domain ?

The geometry constraint achieves this amazing feat by connecting to a
special attribute on shape nodes called 'geometry', which is explicitly
intended for geometry constraints.

In other words, all of Maya's shape nodes have been specially modified to
work with the geometry constraint.  Since we, as 3rd-party developers,
don't have the ability to modify the internal workings of Maya's existing
nodes, we are necessarily limited in the sort of constraint behaviours we
can implement.  But we can use the existing hooks to create variations on
existing behaviours.

For example, let's say that you want to write your own constraint node
which does the same thing as the geometry constraint.  Then you would give
your constraint node a generic input attribute which takes the various
kinds of geometry (mesh, nurbs surface, subd surface, nurbs curve) and a
generic output attribute which you would use to feed the input geometry
into the constrained object's 'geometry' attribute.  E.g:

  pSphereShape1.worldMesh[0] --> myConstraint.inGeometry

  myConstraint.outGeometry --> locator1.geometry

In your node's compute() method all you have to do is copy the geometry
from 'inGeometry' to 'outGeometry' and you'll achieve your effect.


But note that there's nothing to stop you from *changing* the geometry
before passing it on to the 'outGeometry' attribute.

For example, let's say that you wanted your constraint to allow an offset
at which the constrained object would float above the surface of the
geometry.  Then in your compute() method you would take the geometry from
'inputGeometry' and modify it so that all of its points are 'offset'
distance further from the object's center than they were before, then write
that new geometry into your 'outputGeometry' attribute.

===========================================================================
 - deane                          Gooroos Software: Plugging you into Maya

                         Visit http://www.gooroos.com for more information

-- ---- ---- ---- ---- ---- ---- ---- ---- ---- ---- ---- ---
List-help: <mailto:listar@(protected)?Subject=help>
List-archive: <http://www.highend3d.com/maya/devarchive/>