physics simulation of an area. It delineates where an object's "edges" are, so that the physics simulation can determine when other objects collide with it. The Representation might be as complex as the exact shape of the object (which can be very CPU-intensive), or as simple as a rectangular box (easier on resources, but perhaps not as satisfying in gameplay). The choice of how detailed a representation to use, is up to your design team.
To view collision representations, open the Physics panel and select the View Physics Data checkbox.
The collision representation for any particular asset instance is drawn from one of the following three sources:
- If no other change has been made, it is automatically set to
- EXACT MESH, if it is a STATIC object (see PhysicsType)
- CONVEXHULL, if it is a DYNAMIC object
- If the collision representation has been modified via the Physics Shape Editor in the Physics Panel, then a Physics INI file is created in the Repository to maintain this new information. This then affects all instances in the world which have been created from that particular asset, if those assets are set to use DEFAULT_SHAPE in their PhysicsShape property
- The above two methods can be overridden on a per-instance basis, by directly modifying the PhysicsShape property in the Properties panel from DEFAULT_SHAPE to something else such as:
- Simple Sphere
- Simple Box
Note: Even when using some other type of Collision Representation, the original mesh artwork representation is still also in existence, since it is needed for raycasting and Line of Sight checks, which are always done with the original artwork.
- Go to a test area
- Open the Physics panel
- This panel deals with the mesh representations that are used to determine collisions between characters and their environment, or between different objects that might be colliding with each other
- Select the "View Physics Data" checkbox and make sure that the "View Server Physics" is off (unchecked).
Look at your character, and note that the wireframe representation appears as a lozenge shape (you may need to bring your viewpoint closer to your character to see it). You should also be able to see collision representation gridlines in a portion of the nearby heightmap, and around any nearby objects.
It is important to understand that the physics representation of a character or object, may not be an exact representation of how the object looks, but is instead a simplified version to speed up processing. However, this is customizable, as will be seen in this tutorial, so the detail of the representation can be increased or decreased, as desired for your own game design.
- Move your viewpoint around the area, and note that the visualization only goes out a certain distance from your current viewpoint.
- In the Physics Panel, move the Distance slider, and note how the representation distance changes in the viewport. End with a value of around 2.00.
- Create a static object (for example, add a signpost) and attempt to walk your character into it and near it. Note that the collision occurs not necessarily when your character's arm or leg approaches the object, but when the lozenge (the collision representation) intersects with the collision representation of the other object.
- Create another object, such as a sphere or cube. In the Properties panel, set PhysicsType to DYNAMIC. Duplicate the object(s) with CTRL-D a few times. Lift and drop them on top of each other, or walk your character into them, or drag them into each other with the Select & Translate Tool, to see how they behave.
- If you lift an object into the sky, you will need to click away from it briefly before it will "fall".
When an object has an animation, the physics representation will be based on its static pose.
- Load an animated asset
- If not sure which to use, use Create menu > Model > Load Asset, and add the one at \demo\animatedassets\bladeslot_maya.gr2, then go to Create > Model > Bladeslot_maya.gr2
- Note that the physics representation of the asset stays constant, regardless of how the asset appears to move
- Select the asset with the selection tool, and note how the physics representation is red in color
- In the Physics Panel, note that each type of representation is mapped to a different color. These work for physics representations, in a somewhat similar way to how the Filters menu works for other types of assets.
- Continue to experiment with other of the collision groups. For example, uncheck and re-check:
- CG_PLAYER to turn off the "lozenge" shape for your character
- CG_GENERAL to turn off the physics representation for the heightmap
- To quickly clear all the checkboxes, click the Deselect All Groups and Deselect All Flags buttons.
- Re-select all checkboxes, by clicking the Select All Groups and Select All Flags buttons.