Lumberyard
User Guide (Version 1.15)

Creating a Dynamic PhysX Object

A dynamic PhysX object is a rigid body that provides collision geometry and that has a set of properties that define the way it reacts to forces and collisions. To create a dynamic PhysX object, you can use a .pxmesh file to provide collision geometry or you can use a Shape component.

To create a dynamic PhysX object

  1. Create an entity.

  2. Add the PhysX Collider component to the entity.

  3. Add one of the following components:

    • PhysX Mesh Shape component

    • Shape component (Box, Capsule, or Sphere. Not currently supported: Cylinder, Compound, and Polygon Prism components).

    
                        Add either a PhysX Mesh Shape or a Shape component
  4. If you added a Shape component, go to the next step.

    If you added a PhysX Mesh Shape component, you must specify a .pxmesh file. To do this, in the Entity Inspector, click the (...) icon next to PxMesh. Navigate to the .pxmesh file you exported previously.

    
                        Click to select a .pxmesh file for the PhysX Mesh Shape
  5. Add the PhysX Rigid Body Physics component. Set the Motion type to Dynamic, which exposes a set of parameters. See PhysX Rigid Body Physics to set the parameters that define how your dynamic object reacts to forces and collisions.

    You now have a dynamic PhysX object in your scene, but you can't see it.

  6. To add a visible component to your entity, add a Mesh component.

  7. Next to Mesh asset, click the (...) icon and navigate to the mesh asset to provide the visible portion of your entity.

  8. If you place the entity above the terrain and then enter game mode (press Ctrl+G), you see your object fall and bounce around.

    Press Esc to exit game mode.

    
                        Animated demonstration of a dynamic object falling to the terrain and bouncing around