Back to Entitycomponentsystemsamples

Unity Physics Samples

PhysicsSamples/README.md

latest13.8 KB
Original Source

Unity Physics Samples

For more Phyiscs and DOTS starter material, see the main page of this repo.

Controls

In the Game window:

  • Mouse spring : Click and drag with left mouse
  • Camera rotate : Click and drag with right mouse
  • Camera move : W,A,S,D keys

Debug Display

A lot of the demos display extra information as debug display gizmos in the Editor, for example the Query demos (ray cast, distance cast, etc). This display for these gizmos is in the Scene not the Game window. So keep an eye on both if in doubt:

Scene viewGame view

Scene List

CategorySceneDescriptionLevel
Hello World<sub>Hello World.unity</sub>Introductory scene for rigid body setupIntroductory
Hello World<sub>SphereAndBoxColliders.unity</sub>Basic collidersIntroductory
Hello World<sub>GravityWell.unity</sub>Introductory sceneIntroductory
Setup<sub>2a1. Collider Parade - Basic.unity</sub>Demo showing various shapes for collision detectionIntroductory
Setup<sub>2a2. Collider Parade - Advanced</sub>Demo showing various shapes for more advanced collision detectionIntroductory
Setup<sub>2b1. Motion Properties - Mass.unity</sub>Demo showing how to explicitly set mass properties using custom (yellow) and built-in (grey) authoring componentsIntroductory
Setup<sub>2b2. Motion Properties - Velocity.unity</sub>Setting initial linear and angular velocitiesIntroductory
Setup<sub>2b3. Motion Properties - Damping.unity</sub>Demo showing the effect of linear and angular dampingIntroductory
Setup<sub>2b4. Motion Properties - Gravity Factor.unity</sub>Demo showing the effect of per body gravity multipliersIntroductory
Setup<sub>2b5. Motion Properties - Center of Mass.unity</sub>Demo showing the effect of overriding center of massIntroductory
Setup<sub>2b6. Motion Properties - Inertia Tensor.unity</sub>Demo showing the effect of overriding inertia tensorIntroductory
Setup<sub>2b7. Motion Properties - Smoothing.unity</sub>Demo showing the effect of interpolation and extrapolationIntroductory
Setup<sub>2c1. Material Properties - Friction.unity</sub>Showing effect of different friction material valuesIntroductory
Setup<sub>2c2. Material Properties - Restitution.unity</sub>Showing effect of different restitution valuesIntroductory
Setup<sub>2c3. Material Properties - Collision Filters.unity</sub>Showing effect of different collision filtersIntroductory
Setup<sub>2d1. Events - Triggers.unity</sub>Demo demonstrating the usage of triggersIntroductory
Setup<sub>2d2. Events - Contacts.unity</sub>Showing effect of different contactsIntroductory
Query<sub>3a. All Hits Distance Test.unity</sub>Demo showing results of distance queries between multiple collidersIntroductory
Query<sub>3b. Cast Test.unity</sub>Demo showing the results of collider casting and ray castingIntroductory
Query<sub>3c. Closest Hit Distance Test.unity</sub>Demo showing results of distance queriesIntroductory
Query<sub>3d. Custom Collector.unity</sub>Demonstration of raycastIntroductory
Joints<sub>4a. Joints Parade.unity</sub>Demo showing a range of joint typesIntroductory
Joints<sub>4b. Limit DOF.unity</sub>Showing effect of limiting degrees of freedomIntroductory
Joints<sub>4c1. All Motors Parade.unity</sub>Demo showing different motorsIntroductory
Joints<sub>4c2. Position Motor.unity</sub>Demo showing position motorIntroductory
Joints<sub>4c3. Linear Velocity Motor.unity</sub>Showing linear velocity motorIntroductory
Joints<sub>4c4. Angular Velocity Motor.unity</sub>Demonstrating angular velocity motorIntroductory
Joints<sub>4c5. Rotational Motor.unity</sub>Demonstrating rotational motorIntroductory
Joints<sub>4d. Ragdolls.unity</sub>Obligatory stack of ragdolls demoIntroductory
Joints<sub>4e. Single Ragdoll.unity</sub>GameObject ragdoll for Unity Physics (left) and built-in physics (right), created using the Ragdoll WizardIntroductory
Modify<sub>5a. Change Motion Type.unity</sub>Demo showing change of motion typeIntroductory
Modify<sub>5b. Change Box Collider Size.unity</sub>Demonstrating runtime change of collider sizeIntroductory
Modify<sub>5c. Change Collider Type.unity</sub>Demonstrating change of collider typeIntroductory
Modify<sub>5d. Change Velocity.unity</sub>Demo showing change of velocityIntroductory
Modify<sub>5e. Kinematic Motion.unity</sub>Demo showing kinematic motion in combination with dynamic objectsIntroductory
Modify<sub>5f. Change Surface Velocity.unity</sub>Demo showing change of surface velocityIntroductory
Modify<sub>5g1. Change Collider Material - Bouncy Boxes.unity</sub>Demo showing effect of unique prefab instantiation with collider material changesIntermediate
Modify<sub>5g2. Unique Collider Blob Sharing.unity</sub>Demo showing effect of instantiating prefabs during runtime, making collider blobs unique and sharing collider blob dataAdvanced
Modify<sub>5g3. Runtime Collider Creation.unity</sub>Create mesh colliders during runtimeAdvanced
Modify<sub>5g4. Runtime Collision Filter Modification.unity</sub>Modify collision filters during runtimeAdvanced
Modify<sub>5g5. Modify Collider Geometry.unity</sub>Modify collider geometry during runtimeAdvanced
Modify<sub>5h. Change Scale.unity</sub>Demo showing scale change of entitiesIntroductory
Modify<sub>5i. Apply Impulse.unity</sub>Demo showing application of impulsesIntroductory
Modify<sub>5j. Modify Broadphase Pairs.unity</sub>Filter out collision by explicitly deleting pairs from broad phaseAdvanced
Modify<sub>5k. Modify Contact Jacobians.unity</sub>Modify the results of contact generation to produce special effectsAdvanced
Modify<sub>5l. Modify Narrowphase Contacts.unity</sub>Add new user contacts to simulation pipelineAdvanced
Use Case<sub>6a. Character Controller.unity</sub>User case demo showing a rudimentary FPS character controllerIntermediate
Use Case<sub>6b. Pool.unity</sub>Demonstration of calling immediate mode physicsIntermediate
Use Case<sub>6c. Planet Gravity.unity</sub>Performance demo of asteroids around a planet using SP/HPIntroductory
Use Case<sub>6d. Raycast Car.unity</sub>User case demo showing a set of vehicle behaviorsIntermediate