|
1 | 1 | # Physics 2D LowLevel Examples
|
| 2 | + |
2 | 3 | This repository contains test projects, examples and a test package for use with the LowLevel 2D Physics features in Unity.
|
3 | 4 |
|
4 | 5 | To use the low-level features, you will require Unity 6000.0.3a5 or beyond.
|
5 | 6 |
|
6 |
| - |
7 |
| -# Physics 2D LowLevel Sandbox |
8 |
| - |
9 |
| -This repository contains examples that can be built to a player. |
10 |
| -To run, load the main "Sandbox" scene and press "Play". Alternately, built to a player and run. |
11 |
| - |
| 7 | +--- |
12 | 8 | Acknowledgement and thanks is made to Erin Catto, the creator of Box2D v3, from which significant portions of this "Sandbox" project is based upon.
|
13 | 9 |
|
14 | 10 | Go try it here!
|
15 | 11 | https://github.com/erincatto/box2d
|
| 12 | +--- |
| 13 | + |
| 14 | +### Physics 2D LowLevel Sandbox |
| 15 | + |
| 16 | +This repository contains examples that can be built to a player. To run, load the main "Sandbox" scene and press "Play". Alternately, build to a player and run. |
| 17 | + |
| 18 | +Each sample can be found in "Assets/Scenes/<Category>/<SampleName>" and all share the same configuration. |
| 19 | + |
| 20 | +In each sample there is at least a single ".cs" file containing all the sample code. There's also a ".unity" scene and finally a ".uxml" for the sample UI. |
| 21 | + |
| 22 | +The structure of the ".cs" script file is consistent for all samples and typically contains the following methods: |
| 23 | + |
| 24 | +- OnEnable - Grabs the Sandbox Manager and Camera Manipulator and initializes any sample fields. Also, other global physics or sandbox state may be overriden here. Here we always call "SetupOptions" and "SetupScene" (see below). |
| 25 | +- OnDisable - Typically destroys any temporary storage and restores any global physics or Sandbox state. |
| 26 | +- SetupOptions - This is always called from "OnEnable" and always configures the sample UI to dynamically control the sample (sample option in the lower-level UI). |
| 27 | +- SetupScene - This is always called from "OnEnable" but is also called from the sample UI when pressing the "ResetScene" button on all samples. Here is where all the sample physics objects are created. |
| 28 | +- Update - Some samples use this to perform per-frame updates such as world drawing. |
| 29 | +- Misc - Some samples have miscellaneous methods (sometimes used in "SetupScene") to spawn or control the physics objects. Some are hooked into the pre/post simulate to perform an action when the simulation is about to or has run. |
16 | 30 |
|
| 31 | +The "Scripts" folder are typically utility scripts used by various scenes such as spawning physics objects i.e. ragdolls, softbodies etc. |
17 | 32 |
|
0 commit comments