Free Ebooks
These are free, practical guides for Unity developers who want to actually understand the math behind their games rather than copy-pasting a formula and hoping it works. Every chapter pairs the underlying concept, vectors, quaternions, physics, raycasting, trigonometry, trajectories, with real C# code you can drop into a project, the same way I approach the math in my own shipped Unity work.
This ebook exists because most Unity math content falls into one of two traps: either it's an abstract linear-algebra lecture with no game code in sight, or it's a single copy-pasteable snippet with no explanation of why it works, which means the moment your use case differs even slightly from the tutorial, you're stuck. Every chapter here is built the other way around: the concept first, in plain language, then the C# implementation, then the specific situations where the naive version breaks (gimbal lock, floating-point drift, frame-rate-dependent physics) and how to actually fix them.
It's aimed at developers who are past the absolute-beginner stage, you've shipped or are shipping something in Unity, but keep hitting a wall whenever a feature needs real vector math, rotation logic, or physics beyond Rigidbody.AddForce. If that's you, working through the chapters in order (they build on each other) will close that gap faster than piecing it together from scattered forum answers, which is how I had to learn most of it myself early in my career.
Written by Anthony KOZAK, a senior game developer with 16+ years of experience (ex-Ubisoft, Eagle Flight VR) and a Unity Asset Store publisher. If you'd rather have this explained live for your specific project, see Unity development training & mentoring or hire me directly.
Mathematics for Unity3D
A comprehensive free ebook covering all the mathematics you need to create games with Unity3D: vectors, quaternions, trigonometry, physics, raycasting, trajectories, and transformation matrices, with practical C# code examples.
Chapters
-
Introduction: Mathematics for Unity3D
How mathematics powers Unity3D game development: vectors, quaternions, physics, raycasting, trigonometry, and trajectories, with C# code examples.
-
Chapter 1: The Basics (Coordinates, Distances and Utility Functions)
Master the foundation of Unity3D math: local vs global space, the Transform component, Vector3, calculating distances, clamping values, percentages, and linear interpolation in C#.
-
Chapter 2: Vectors A to Z (Everything You Need to Know)
Master Unity3D vectors from basics to advanced: movement, rotations, Dot and Cross products, normalization, MoveTowards, space conversion, and visual debugging, with step-by-step C# examples.
-
Chapter 3: Quaternions A to Z (Rotations Without Gimbal Lock)
Demystify Quaternions in Unity3D: understand why they exist, how to create rotations, combine them, interpolate between them, and make objects look at targets, all with practical C# examples.
-
Chapter 4: Tweening and Easing (Smooth Animations in Unity3D)
Create smooth, expressive animations in Unity using Lerp, AnimationCurve, easing functions, and the DOTween library. Learn to implement ease-in, ease-out, and custom curves with C# code examples.
-
Chapter 5: The Unity3D Physics Engine (Rigidbody, Colliders and Joints)
Master Unity3D's built-in physics engine: Rigidbody, colliders, kinematic bodies, compound shapes, collision modes, CharacterController, joints, and how to build a catapult, with C# code examples.
-
Chapter 6: Physics Programming (Forces, Torque, and Applied Math)
Apply forces, torque, impulses, and acceleration to Rigidbodies in Unity3D. Understand ForceMode types, FixedUpdate timing, flickering solutions, and build physics-based games with step-by-step C# examples.
-
Chapter 7: Mastering Raycasting (Detection, Shooting, and Ground Checks)
Master raycasting in Unity3D: detect objects, implement shooting mechanics, ground checks, shape casting, layer filtering, and explosion forces. Includes complete exercises for 2D ground detection and a 3D duck shooter game.
-
Chapter 8: Trigonometry (Sine, Cosine, and the Turret Controller)
Apply trigonometry in Unity3D: radians vs degrees, sine and cosine functions, finding points on circles, Atan2 for angles from vectors, vector projection onto planes, and build a complete turret aiming system.
-
Chapter 9: Trajectories (Ballistic Physics and Projectile Math)
Calculate and visualize projectile trajectories in Unity3D: launch direction, maximum height, range, flight time, mid-air positions, and reverse-engineer a trajectory to hit a target, with full C# implementations.
-
Chapter 10: Transformation Matrices (The Math Behind 3D Transforms)
Understand transformation matrices in Unity3D: what a Matrix4x4 is, TRS decomposition, how to use matrices for custom transforms, shader math, batch transformations, and advanced parent-child relationships.
-
Conclusion: What You've Learned and Where to Go Next
Reflect on the complete journey through Unity3D mathematics: a full recap of all 10 chapters, what skills you've gained, recommended next steps, and resources to continue your game development education.