Physics mini-game tutorial
NOTE: Apologies to HeroCloud developers, character capsules are not interacting with dynamic physics objects in the current version of the HeroCloud (Topaz release). It will be rectified in the next publish. In the mean time you can still use all the information here to setup dynamic physics objects and have them interact with each other and the world, but the character and its physics capsule will pass through them.
In this tutorial, you will create a test area where your character needs to "herd" objects into a sinkhole in the area.
- Static and dynamic objects
- Physics toolbar options
- Physics nodes controlling the physics simulation for a group of objects
- Physics properties in the Properties panel
- In a test area, create a new heightmap.
- Use the Terrain panel to create some bumpy terrain, along with a flat area, and at least one fairly large sinkhole.
- Choose the Selection Tool
- In the flat area, create a utility sphere.
- In the Properties panel for the sphere:
- Set PhysicsType to DYNAMIC
- Set PhysicsDensity to 0.3 (not too heavy, not too light, this is a good value to make it pushable)
- Set Scale to 2,2,2 (setting the scale larger, ensures that the sphere will be pushable, rather than just something to step on)
- Click away from the sphere to de-select it, and it will drop to the heightmap below and settle in a natural location. If it falls into the sinkhole, move it to another part of the heightmap with the Select & Translate Tool and drop it again.
- Update the server physics by Selecting 'Update Selected Server Physics' from the physics dropdown menu to notify the server of the new location of the sphere (for more information on how this works, see Placing assets with physics).
- Select the sphere, and in the properties panel, set its PhysicsType to STATIC
- Setting the spheres to static, makes it easier to duplicate them, since otherwise they might immediately "collide" with another sphere and go bouncing somewhere
- Duplicate a few more spheres with CTRL-D, and place them around the flat area, near the "sinkhole" of your test area.
- Select all of the spheres by clicking and dragging a box around them, or Ctrl-clicking them individually.
- In the Properties panel, which should now be affecting all of the selected spheres, set their PhysicsType to DYNAMIC
- Click away from the spheres, to ensure that they have all "dropped" to a stable location.
- Select all of the spheres again, and click on the Update the server physics by Selecting 'Update Selected Server Physics' from the physics dropdown menu again to update their location.
- With all the spheres still selected, select 'Create Physics Node' from the physics dropdown, to create a Physics node. It should be automatically connected to all of the spheres (you may need to adjust your viewpoint to see it, since it will be created at your current viewpoint).
- The Physics node should now be the selected object. In the Properties panel, set its ACTIVE property to TRUE
- Move your viewpoint closer to the heightmap, and go into character mode.
- Your character should drop to the heightmap. If it doesn't, you may need to go back into camera mode and move your view closer to the heightmap before going into character mode.
- Run your character into the spheres, which should now bounce off your character. Try to herd all of them into the sinkhole.
- Note: If any of them go flying off the edge of the heightmap, don't worry about it for now.
- Once you're done, select the Physics node again.
- In the Properties Panel, set the Physics node's ACTIVE property to FALSE
- All of the spheres should restore to their starting location
- To start the game again, just turn the Physics Node's ACTIVE property back to TRUE, and away you go!