Physx integration
We fully integrated Physx into Atoms. This means you can both use it within you crowd simulations or as a separate tool for running rigid body simulation.
We provide tools for creating/editing rigid bodies and constrain them.
You can also create aggregates, if you don't know what an aggregate is here is an extract from Physx documentation:
An aggregate is a collection of actors. Aggregates do not provide extra simulation or query features, but allow you to tell the SDK that a set of actors will be clustered together, which in turn allows the SDK to optimize its spatial data operations. A typical use case is a ragdoll, made of multiple different actors. Without aggregates, this gives rise to as many broad-phase entries as there are shapes in the ragdoll. It is typically more efficient to represent the ragdoll in the broad-phase as a single entity, and perform internal overlap tests in a second pass if necessary. Another potential use case is a single actor with a large number of attached shapes.
We have exposed all Physx attributes for rigid bodies and constraints, for this reason throughout this section we will link few times to Physx documentation where you will be able to get all the information you need.
Atoms Solver
The first time you create a rigid body Atoms will create a tcAtomsSolver node if it does not exist in the scene yet. The solver node takes care of passing data from Maya to Physx and viceversa.
Its "enable" state is off by default, you have to turn it on if you want Physcs to run in your scene.
The solver node contains all the global parameter which will affect Physx simulation such as gravity, scale, sub samples for each frame, etc.
Please have a look at Physix docs to know more.
Rigid bodies
Any geometry can be used to create a rigid body.
Select your geometry or geometries and click on: Atoms > Physx > Create Rigid Body or use the AtomsPhysx shelf button:
Atoms will create a tcAtomsRigidBody node for each object and connect it to the solver node. Each rigid body has its own properties which can be edited.
name | description |
---|---|
active | enables this rigid body |
type |
|
meshType |
Please find more info here. |
useMass | If off, Physx calculate automatically the rigid body mass using the density attribute and the volume of the object |
mass | The mass if useMass is on |
linearVelocity | The inital linear velocity |
angularVelocity | The initial angular velocity |
maxAngularVelocity | Max value for the angular velocity |
dynamicOnCollision | Useful on kinematic objects. If on, Physx converts a kinematic object to dynamic when colliding with another rigid body. |
collisionForceThreshold | The force threshold for the kinematic to dynamic conversion, if the force magnitude is lower than this value the object won't be converted |
disableCollisionEvent | Only used for the ragdoll setup, when this attribute is set the collision event does not convert this object from kinematic to dynamic |
stuckOnCollision | The rigid body will create a fixed constraint between this object and the collided object |
stuckCollisionBreakForce | The first value is threshold linear force, while the second value is threshold torque force |
Collision pool | Rigid bodies with the same collision pool id will not collide with each other |
Aggregate | Rigid bodies with the same aggregate id will be clustered together. Each rigid body can belong only to one aggregate. |
After creating the rigid bodies, you can edit the object transforms using the "Input Transform" attributes. This is because the solver connects the computation output to the default translation attributes of each transform.
For all the other attributes please have a look at Physx documention.
Debugging
When you need to debug the actual mesh that Physx uses for each rigid body, you can activate the "Debug" draw attribute on the rigid body node.
Fields
Depending on your host application, you can create force fields to apply forces on rigid bodies.
Force fields are also connected to the solver node. We use standard host nodes for this purpose.
Constraints
Having selected two or more rigid bodies click on: Atoms > Physx > Create Constraint or use the AtomsPhysx shelf button
The first object will be always the driving object of the constraint.
As first thing make sure the X axis of the constraint points towards the driven object (Physx uses the X axis as the main axis while solving constraints).
Each constraint has its own properties which can be edited.
name | description |
---|---|
active | enables this constraint |
type |
Please have a look here for more info. |
enableCollision | Enables the collision between two constrained objects |
breakable | Makes the constraint breakable |
break force | Linear force limit |
break torque | Torque force limit |
Limits for all constraint types are also available.
Please have a look at the Physx docs to know more about constraints.
Aggregates
Atoms Crowd provides a handy way to manage aggregates: the aggregate manager.
You can access it with menu Atoms > Physx > Show Aggregate Manager or with the AtomsPhysx shelf button
You have 4 buttons on the top bar of the aggregate manager:
- creates empty aggregate
- creates an aggregate with the selected rigid bodies or adds the selected rigid bodies to the selected aggregate
- removes the selected rigid body from the aggregate or deletes the selected aggregate
- refreshes the list
This UI takes care of editing the aggregate attribute of each rigid body.
Please note, each rigid body can belong only to one aggregate.
Copyright © 2017, Toolchefs LTD.