W2D2: Physics (part 2), sound and particles
Rigidbody settings, collider types, compound colliders, 2D physics, audio sources, reverb zones, mixer ducking and a particle system built from scratch.
Lucian Lazar · 17 Jul 2024
Second half of the physics material, then two subjects that most beginner courses skip entirely: sound and particles. This is a hands-on session — Lucian is in the editor the whole time, poking at inspector fields, and he’s upfront about which ones he’s used in production and which ones he’s never touched. If you want a tour of what Unity gives you for free before you start writing code, this is it.
What’s covered
Rigidbody, field by field
- Mass as a relative thing: a 1000kg marble pushes a 1kg beach ball, size doesn’t matter
- Drag and angular drag — Lucian’s honest take is that he’s barely used them, they approximate air density per object, and most of the time you leave them alone
- Automatic center of mass, plus the trick of parenting an empty child at the center-of-mass coordinates so you can actually see where it is
- Use Gravity vs Is Kinematic, and why kinematic overrides gravity (mnemonic: think “cinematic” — something else moves it, physics doesn’t)
- Interpolate and collision detection modes: discrete, continuous, and the rest. The tunnelling explanation is the useful bit — at 60 physics steps a second, a fast object is on one side of a wall on one frame and the other side on the next, so no collision ever happens
Colliders
- Box, sphere, capsule — what gets added by default to primitives, and why there’s no cylinder collider
- Mesh colliders: accurate, expensive, and usually the wrong answer
- Compound colliders. Build a “character” out of a sphere for the head and capsules for the arms, and get 99% of the result for 1% of the cost
- How
OnCollisionEnterbubbles up: the arm has no script, so the message goes to the first parent that has a MonoBehaviour defining it - Rigidbody with no collider at all — it still works, it just can’t hit anything
2D physics
- Separate rigidbody and collider components because 2D is cheaper to simulate
- The 2D and 3D simulations are completely independent — your 2D player will fall straight through a 3D box collider
- Polygon, edge and composite colliders, briefly. Lucian hasn’t used them much and says so
Sound
- Audio Source and Audio Listener, and why Unity complains when a scene has two listeners
- Spatial blend (the 2D/3D slider), min and max distance, Doppler
- Playing a clip from code on collision, and turning off Play On Awake
- Trimming leading silence in Audacity so hit sounds land on impact instead of half a second later
- Reverb zones — they act on the listener, not the source, like post-processing for your ears
- The Audio Mixer: groups, routing output, and ducking with a Duck Volume effect plus a Send from the SFX group
Particles
- A free asset pack’s demo scene as a tour of what’s possible: explosions, fireworks, rain, sub-emitters, camera shake
- Building one from scratch: emission rate, max particles, color over lifetime, size over lifetime, trails with a material, noise, random start speed between two constants
Timestamps
- 00:00:00 — Curriculum correction: the Wednesday masterclass is now pure C#, everything else shifts down a day
- 00:03:30 — Why physics is the highest-impact low-effort thing in Unity, and mass explained with colliding spheres
- 00:07:00 — Drag and angular drag, and an honest “I’ve never really needed this”
- 00:10:30 — Center of mass, local vs world position, and the empty-child trick to visualise it
- 00:16:00 — Use Gravity, Is Kinematic, and the “cinematic” mnemonic
- 00:21:00 — Interpolate, discrete vs continuous collision detection, and objects tunnelling through walls
- 00:26:30 —
OnCollisionEnteras a Unity message, and what the Collision object actually contains - 00:31:00 — Rigidbody without a collider, freeze position, freeze rotation
- 00:35:00 — Collider types: box, sphere, capsule, no cylinder, and mesh colliders being expensive
- 00:43:00 — Compound colliders for complex characters, and how collision messages reach the parent
- 00:52:00 — 2D physics: rigidbody 2D, box/polygon/edge colliders, and why 2D and 3D never touch each other
- 01:03:00 — Wheel colliders and a motorbike that refuses to work; use Standard Assets instead
- 01:11:00 — Audio Source and Audio Listener, duplicate listener warnings, hearing sound move left and right
- 01:15:00 — Spatial blend, Doppler, min/max distance spheres
- 01:21:00 — The cube-with-eyes demo: play a sound from
OnCollisionEnter, and why Play On Awake exists - 01:27:00 — Cutting silence off the front of a hit sound in Audacity
- 01:30:00 — Reverb zones and why they target the listener rather than the source
- 01:37:00 — Audio Mixer basics, groups, output routing, and the render-texture analogy for why routing matters
- 01:46:00 — Ducking: Duck Volume on the background group, Send on SFX, threshold tuning, before-and-after
- 01:57:00 — Particle system asset pack demo scene, sub-emitters, camera shake
- 02:05:00 — Building a particle system: emission rate, max particles, color over lifetime, size over lifetime
- 02:15:00 — Trails with a material, noise strength, randomised start speed between two constants
- 02:26:00 — Wrap-up and what tomorrow’s C# masterclass covers
What you build
A scene that demonstrates each piece rather than one big project. A compound-collider dummy made of a sphere and two capsules, so you can watch a ball ricochet off an “arm” and see the collision message land on the parent. A falling cube with eyes that yells “ouch” when it hits the ground. An audio mixer where dropping water ducks a highway ambience. And a particle system that goes from the default white puff to something that looks like a chemical flame — orange at the base, purple as it fades, trails on, a bit of noise, and randomised speeds so it doesn’t look mechanical.
The motorbike doesn’t work. Lucian builds two wheel colliders and a cube, it flies off into nothing, he spends a few minutes trying to fix it live and then moves on. If you’ve ever wondered whether experienced developers also fail at this in front of people, there’s your answer.
void OnCollisionEnter(Collision collision)
{
GetComponent<AudioSource>().Play();
}
That's the whole hit-sound script. The work is in the inspector: uncheck Play On Awake, assign the clip, and trim the silence off the start of the file so the sound fires on impact.
## Who should watch this
If you've only ever moved objects with `transform.position`, this shows you how much of a game the physics and audio systems will do for you without a line of code. The ducking section is the one to pay attention to — it's a ten-minute setup that, in Lucian's words, turns a four-star game into a five-star game, and most people never touch it. Skip it only if you already know the rigidbody inspector by heart and have shipped something with a working audio mixer.
Part of the full curriculum. Course overview.