- This page is about the HeroBlade panel, along with a tutorial for how to test and save different collision representations for various objects. For the toolbar, see Physics Toolbar.
The HeroBlade Physics Panel is primarily used for debugging purposes, or to make advanced adjustments to the Collision Representations for specific assets.
Physics Debug Options
The top section of the Physics Panel, labeled "Physics Debug Options", controls the visualization of the Collision Representations. Each object in the viewport can be a member of a Collision Group (CG). The checkboxes in the Physics Panel allow you to select and de-select which CGs that you would like to see at any one time.
The color swatch next to each Collision Group shows the color that will be used in the Viewport for that Collision Group. Usually this is a wireframe, but this can also be displayed as a solid color with the dropdown menu. Commonly seen types of Collision Groups include:
- HEIGHTFIELD (Heightmap)
Physics Shape EditorPhysics INI file in the Repository. Once published, every instance of that asset in the world adopts the new form of collision representation, unless that instance has been specifically overridden, on a per-instance basis, via the PhysicsType field in its Properties panel.
Options in the Shape Editor are:
- The asset's collision representation is based on the polygon mesh of the object. Standard for STATIC objects. This type of representation is very precise, but can also be very CPU-intensive, so it is often better to come up with a more streamlined method.
- Standard for DYNAMIC objects. This is a sort of shrink-wrapped version of the object
- The object's collision representation is based as though it is shaped like a rectangular box
- The object's collision representation is based as though it is a faceted sphere
- Customizable collision representation, made by "gluing" several convex hulls together. A "Decomposition Depth" slider on the panel can adjust the detail of the shape.
Testing new shapes
To test a new representation:
- Select an asset
- In the Properties panel (not the Physics panel), ensure that:
- PhysicsType is set to DYNAMIC
- PhysicsShape is set to DEFAULT_SHAPE (so that it won't override the Physics Shape Editor)
- Close the Properties panel
- In the Physics panel (not the Properties panel), ensure that:
- The Visualize Physics Data checkbox is selected, at the top of the panel
- The dropdown under the checkbox says WIREFRAME
- A red physics shape should be visible around the selected object. If you cannot see one, you may need to move your view closer to the object, or adjust the "Visualization Distance" slider at the top of the Physics panel
- If the physics shape cannot be seen, move your view in the viewport closer to the object.
- If the physics shape appears to be in a different location than the actual object, this is probably because the object has fallen or rolled to a different spot from where it started. See Placing assets with physics for a tutorial on how the server-side collision representation may be different from what is viewable on the client. For now, this can be addressed by moving the object with the Select & Translate Tool to a stable location on the ground, which will sync up the representation.
- The color of the collision representation may change depending on many factors, such as whether the object is selected or not, or if it is a member of some other Collision Group. If selected, it will be red. If not selected, it will usually be blue, which is the standard color for "Dynamic" objects. However, different colors may be indicative of a more complex object, such as one that has had parts of its geometry set to "no-collide", or a "water" asset, or heightmap, or one of dozens of other categories of Collision Groups.
- With some assets, the collision representation may be difficult to see because it is too close to the exact shape of the object (or may even be inside the object itself). In these cases, to be better able to see the collision representation, use the Filters menu to turn visualization off for that type of asset, so you will only be seeing the collision representation.
- In the Physics Shape Editor subpanel, select a desired type of representation from the dropdown menu, (such as CONVEXHULL)
- Click on the Test Build Asset button.
The new physics shape should appear around the selected asset.
- If nothing appears to happen:
- Move your viewpoint closer to the object, and/or
- Select a different type of shape from the dropdown menu
- From here, you can test the new collision representation by walking your
character into it, dropping the object from the sky, dropping other physics-enabled onto it, dropping the object onto other physics-enabled objects, etc.
Note: The "Test Build Asset" button only modifies the representation for testing purposes, only in your current area and is not saved.
- Try different shapes from the dropdown menu, clicking on "Test Build Asset" after each one.
- Once you have a shape you like, click Build and Publish (if doing this tutorial in a live area, you may wish to check with your supervisor first as to whether it's okay to publish). When the Build and Publish button is clicked, the new representation is thereby saved to the Physics INI file in the Repository. Publishing also instantly updates all instances of this asset in the entire game (not just your area!) that are set to "DEFAULT_SHAPE" in their properties. The "Default Shape" term means that the collision representation is being drawn from the setting in the Shape Editor.
Aside from a sphere, box, exact mesh, or convex hull, it is also possible to create a custom collision representation, which offers a Convex Decomposition of the object.
CUSTOM_SHAPE for player collision is:
- More efficient (runs faster)
- More appropriate
The goal is to make things as simple as possible, but as complex as necessary.
To create a custom shape:
- Select an object
- Ensure that "Visualize Physics Data" is selected at the top of the Physics Panel
- Set the dropdown menu in the Physics Shape Editor to CUSTOM_SHAPE
- Click the Test Build Asset button
- Move the Decomposition Depth slider to a different value
- Click the Test Build Asset button again, and observe how the shape changes depending on the position of the slider
- Note: If nothing appears to happen when you click "Test Build Asset", try moving your view in the viewport forward and back a bit, to update the viewport.
Tutorial: Physics Shape Editor
For STATIC objects, the "Shape" of a physics representation is something specified by the artist when an asset is being created. When the object is set to be DYNAMIC, the collision representation will automatically switch to CONVEXHULL. However, sometimes designers may wish to create a custom shape for an object.
- For the purpose of this tutorial, load a static asset with an unusual shape. For example, Create a signpost.
- Select the asset.
IMPORTANT: The Properties panel property of PhysicsShape overrides anything that is set via the Physics Shape Editor. In the below example, it means that the particular instance of this object's collision representation will always be "Convex Hull". However, other instances of the same object which still have properties as "Default Shape", will match whatever was published via the Shape Editor.
To ensure that the shape can be edited, do the following before proceeding with this tutorial:
- Open the Properties panel for the selected object
- Set the PhysicsType to DYNAMIC.
- Check that the PhysicsShape property is set to DEFAULT_SHAPE.
- Close the Properties panel
- Back in the Physics panel, in the Physics Shape Editor subpanel, the path of the asset should appear under Selected Asset
- In the Player Collision dropdown menu, it probably says EXACT_MESH. This is not an indicator of the object's current collision representation, but simply the first item on the list.
- Click on "Test Build Asset" to set "Exact Mesh" as the object's collision representation.
- Note: When testing, this affects only the instance of the object that you are currently working with, and the information is not saved unless you actually click on "Build and Publish".
- Walk your character closely past the object, and note that the character can pass by easily.
- Change the dropdown menu to SIMPLE_BOX, and then click on Test Build Asset
- A blue box should now appear around the asset. This color in the upper section of the Physics Panel is PLAYER_COLLIDE
- Try walking your character closely past the object now, and note that you may not be able to get as close to the object, since you're bouncing off the "box" which is the collision representation.
- Change the dropdown menu to SIMPLE_SPHERE, click on Test Build Asset, and observe the sphere that appears as a collision representation
- Again, try walking your character closely past the object, to see where the collision occurs
The box and sphere are very light in terms of CPU resources, but not as useful for game play. A happy medium between "Exact Mesh" and the box or sphere, is a convex hull. This can be thought of as a sort of "Shrink-wrapped" version of the object.
- Select Convex Hull from the dropdown menu, and click Test Build Asset
- Observe the blue box around the object now, and again walk your character near the object to see where the collisions occur.
- To make the shrinkwrap "tighter":
- Choose CUSTOM_SHAPE in the dropdown menu and click on "Test Build Asset". This creates a series of convex hulls, glued together to approximate the shape of the object.
- Adjust the "Decomposition Depth" slider to a higher value, such as 8, and then click on "Test Build Asset".
- Experiment with different values of the Decomposition Depth, clicking "Test Build Asset" after each one, to see how the collision representation changes. The higher the Decomposition Depth, the closer the fit. In your own game, it will be up to your designers to choose a representation which best suits your needs, balancing between CPU resources and game playability.
Note that each change to a Test Build Asset here is affecting only the version on your own client, and not the server representation. If you were to click on Build and Publish, this would send your choice of physics representation to the server, which would then update the collision representation of all objects of this type in the game (it is recommended to not do this as part of the tutorial)
Server physics representation
To see the difference between the client and server physics representations:
- Select the signpost
- In the "Physics Shape Editor", choose "Simple Sphere" and then press "Test Build Asset"
- At the top of the Physics Panel, select the checkbox that says "Visualize Server Physics". The sphere should disappear and the mesh will return to the form it was in originally, probably closely hugging the object.
- With the Select & Translate Tool, move the object a short distance
- For a brief moment, the representation of the object should stay in the same location, because the server has not yet recognized that the object has moved
- To update the location, move your view in the viewport forward or back slightly, which will refresh the server's representation, which should sync back up with the current location of the object.
- Uncheck the Visualize Server Physics checkbox
- The sphere should return, and when you move the object now, its collision representation will move with it immediately, since you are only looking at the client version of it.