Skip to content
Permalink
Branch: master
Find file Copy path
Find file Copy path
Fetching contributors…
Cannot retrieve contributors at this time
44 lines (27 sloc) 3.35 KB

PhysX Terrain

The PhysX Terrain component exports and saves the terrain as an asset that loads at runtime. The PhysX Terrain component is required for games in which physics interacts with the terrain. For example, you can create a terrain collider so that your entities can interact with it, such as a barrel that falls to the ground and then rolls to a stop.

For more information about using PhysX components, see Simulating Physics Behavior with the PhysX System.

Topics

PhysX Terrain Component Properties

[PhysX Terrain component properties.]

Property Description
Collision Layer Specifies on which Collision Layer the terrain exists. You can configure Collision Layer settings in the PhysX Configuration window. See Configuring the PhysX System.
Collision Group Specifies the group of layers in which the terrain collides. You can configure Collision Group settings in the PhysX Configuration window. See Configuring the PhysX System.
HeightField Asset A read-only parameter that specifies the height field asset that contains the terrain. This property can't be changed.
Terrain In Editor If set, terrain physics exist while editing. This means raycasts can be performed in Lumberyard Editor and can be viewed in the PhysX Visual Debugger. For more information, see Debugger Configuration.

Creating a PhysX Terrain Collider

As a best practice, create a top-level entity in your level and add the PhysX Terrain component. You only need one entity with the PhysX Terrain attached for your level.

To create a PhysX Terrain Collider

  1. In Lumberyard Editor, create an entity. For more information, see Creating an Entity.

  2. Enter a name for the entity, such as terrain.

  3. In the Entity Inspector, choose Add Component and then select a PhysX Terrain component. The terrain collider appears in the viewport. Note
    The Transform component for the entity is ignored and doesn't affect the position of the terrain.

  4. To have an entity interact with the terrain collider, you can create a dynamic entity so that the two entities interact. For more information, see Creating a Dynamic PhysX Entity.

  5. After you create your dynamic entity, press Ctrl+G to enter gameplay mode. The dynamic entity falls and then collides with the terrain collider.

  6. Press Esc to leave gameplay mode.

Note
In some cases, performance can be impacted when a large body intersects the terrain. To overcome this issue, you can clear the Persistent Contact Manifold option in the World Configuration. If you clear this option, keep the size of the colliders that intersect the terrain small.

You can’t perform that action at this time.