MayaPhysx Documentation

MayaPhysx plugin for Autodesk Maya 2011 x86.

Download URL: https://code.google.com/p/maya-physx/downloads/list

Why do develop MayaPhysx?
MayaPhysx plugin has been developed as a personal project, with a purely educational intent which
seeks to understand and learn the Maya API and the PhysX SDK.

How was MayaPhysx develop?
MayaPhysx was initially developed as an implementation of the Nvidia PhysX's SDK samples in
Autodesk Maya. These examples are only available on NVIDIA PhysX Rigid Bodies.
Access to MayaPhysx plugin functionality currently only available under MEL commands.

Which software was used?
To develop the program, the following software was used:
- Autodesk Maya 2011 Educative Version.
- Visual Studio 2008 Express Editions.
- NVIDIA PhysX SDK v2.8.4_win.


MayaPhysx Commands, usage and explanation
MayaPhysx requires the creation of two key nodes in a specific order, MPhysxLocator and
MPhysxScene.
For the plugin initialization you must run the following commands in a Autodesk Maya MEL window:
createNode MPhysxLocator -n MPhysxLocator1;
createNode MPhysxScene -n MphysxScene1;
addAttr -dt "string" -ln "physxMsg" -h true;
expression -string "MphysxSimulateCMD";
By default the gravity of the scene is X=0, Y=-9.8, Z=0. After creating the node MPhysxScene, you
can change the gravity with the following attributes “In Xgravity”, “In Ygravity”, “In Zgravity” :
In MayaPhysx you can create the following rigid objects:
- Ground Plane
- Box
- Sphere
- Convex Mesh
- Triangle Mesh

GroundPlane:
command (MEL)
PhysxCMD -groundPlane;
Synopsis
PhysxCMD -groundPlane is not undoable, queryable, and editable.
This command creates a plane of infinite dimensions in X y Z in the global position (0, 0, 0). It is
useful to create a solid ground on which to perform the simulations. This command does not create
visible objects in the Maya viewport.

Box
command(MEL)
PhysxCMD -box;
Synopsis
PhysxCMD -box is not undoable, queryable, and editable.
This command creates a physical box based on the size of the currently selected object.
Flags
Long name Description Argument type
-ad float
This flag specifies the Angular Damping
which will be created with the physical object
-d float
This flag specifies the Density with
which will create the physical object. If not
density is specified the object will be static.
-ka void
This flag specifies that the object will be
created as a Kinematic Actor (only activated
by contact with a dynamic actor).
-f float float float
This flag specifies the initial force applied to the
object in the X, Y, Z, coordinates at the
simulation start.

Sphere
command(MEL)
PhysxCMD -sphere;
Synopsis.
PhysxCMD -sphere is not undoable, queryable, and editable.
This command creates a phisical sphere based on the height of the current selected object
Flags
Long name Description Argument type
-ad float
This flag specifies the Angular Damping
which will be created with the physical object
-d float
This flag specifies the Density with
which will create the physical object. If not
density is specified the object will be static.
-ka void
This flag specifies that the object will be
created as a Kinematic Actor (only activated
by contact with a dynamic actor).
-f float float float
This flag specifies the initial force applied to the
object in the X, Y, Z, coordinates at the
simulation start.

Convex Mesh
command(MEL)
PhysxCMD -convex;
Synopsis.
PhysxCMD -convex is not undoable, queryable, and editable.
This command creates a physical convex based on the polygons of the currently selected object,
especially useful for a bit more complex forms than boxes or spheres.
NOTES:
- The object must not be more than 256 polygons.
- The command execution will triangulate the selected objects.
- The physical representation of the object will be automatically calculated as a convex shape,
ie, no concavity is taken into account during the simulation.
Flags
Long name Description Argument type
-ad float
This flag specifies the Angular Damping
which will be created with the physical object
-d float
This flag specifies the Density with
which will create the physical object. If not
density is specified the object will be static.
-ka void
This flag specifies that the object will be
created as a Kinematic Actor (only activated
by contact with a dynamic actor).
-f float float float
This flag specifies the initial force applied to the
object in the X, Y, Z, coordinates at the
simulation start.

Triangle Mesh
command(MEL)
PhysxCMD -triangle;
Synopsis.
PhysxCMD -triangle is not undoable, queryable, and editable.
This command creates a phisical trianble mesh based on the polygons of the current selected object,
especially convenient for creation of terrains and complex shapes.
NOTA:
- The Triangle Mesh objects are static, ie can not be moved, rotated and scaled. Any
animation created in the selected object will not be reflected in the physical simulation.
- The command execution will triangulate the selected objects.

Phisical Materials
command(MEL)
PhysxCMD -material;
Synopsis.
PhysxCMD -material is not undoable, queryable, and editable.
When you create any physical object, by default these have assigned a material with a restitution, static
friction and dynamic friction of 0.5.
To create an object with your self material specifications, run the command PhysxCMD -material
followed by the physical object command creation.
Flags
Long name Description Argument type
-r float
This flag specifes the Restitution
-sf float
This flag specifes the Static Friction
-df float
This flag specifes the Dynamic Friction

Bake Simulation
command(MEL)
PhysxCMD -bake;
Synopsis.
PhysxCMD -bake, bakes the simulation for the current selected objects.
NOTA:
- Before you start previewing the simulation you must “set key” the positions and
orientations at the first frame in your time line, for the physical objects. For previewing
the simulation just push play in the animation controls.


PhysxCMD usage samles.
//MayaPhysx initialization
createNode MPhysxLocator -n MPhysxLocator1;
createNode MPhysxScene -n MPhysxScene1;
addAttr -dt "string" -ln "physxMsg" -h true;
expression -string "MphysxSimulateCMD";
//Create a floor for our simulation
PhysxCMD -groundPlane;
//Create a dynamic cube width an angular damping of 0.5 and density of 10.0
PhysxCMD -box -ad 0.5 -d 10.0;
//Create a static cube
PhysxCMD -box;
//Create a Kinematic cube
PhysxCMD -box -ad 0.5 -d 10.0 -ka;
//Create a sphere width an initial force of X = 10000.0 , Y = 0, Z = 0.
PhysxCMD -box -ad 0.5 -d 10.0 -f 10000.0 0 0;
//Create a Convex width a material width a restitution of 0.9, static friction of 0.4 and a
//dynamic friction of 0.5
PhysxCMD -material -r 0.9 -sf 0.4 -df 0.5;
PhysxCMD -convex -ad 0.5 -d 10.0;
PhysxCMD -bake;

Comments

Popular Posts