Table of Contents
About the Authors
About the Technical Reviewer
Acknowledgments
Introduction
Chapter 1: Introduction and Learning Environment
Introduction
Choice of Unity Engine
Setting Up Your Development Environment
Notes on Installing Unity
Unity Editor Environment
Opening the Intro to Unity Project
Working with the Unity Editor
Working with MyScript
To Learn More About Working with Unity
How to Use This Book
Summary
References
Chapter 2: Intervals and Bounding Boxes
Introduction
Review of Cartesian Coordinate System
Intervals: Min-Max Range
Working with Examples in Unity
The Interval Bounds In 1D Example
Examine the Scene
Analyze MainCamera MyScript Component
Interact with the Example
Details of MyScript
Take Away from This Example
Bounding Boxes: Intervals in Three Dimensions
The Box Bounds Intervals in 3D Example
Examine the Scene
Analyze MainCamera MyScript Component
Interact with the Example
Details of MyScript
Take Away from This Example
Collision of Intervals
The Interval Bound Intersections Example
Examine the Scene
Analyze MainCamera MyScript Component
Interact with the Example
Details of MyScript
Take Away from This Example
Collision of Bounding Boxes
The Box Bound Intersections Example
Examine the Scene
Analyze MainCamera MyScript Component
Interact with the Example
Placement of the Bounding Box over the Vehicles
Bounding Box Collisions
Void Space of a Bounding Box
Details of MyScript
Take Away from This Example
Final Words on Bounding Boxes
The Unity Bounds Class
Summary
Chapter 3: Distances and Bounding Spheres
Introduction
Distances Between Positions
The Positions and Distances Example
Examine the Scene
Analyze MainCamera MyScript Component
Interact with the Example
Details of MyScript
Take Away from This Example
Sphere Colliders or Bounding Spheres
The Sphere Bounds Example
Examine the Scene
Analyze MainCamera MyScript Component
Interact with the Example
Details of MyScript
Take Away from This Example
Collision of Bounding Spheres
The Sphere Bound Intersections Example
Examine the Scene
Analyze MainCamera MyScript Component
Interact with the Example
Details of MyScript
Take Away from This Example
The Unity BoundingSphere Class
Summary
Chapter 4: Vectors
Introduction
Vectors: Relating Two Points
Position Vectors
Following a Vector
Following a Vector from Different Positions
The Position Vectors Example
Examine the Scene
Analyze MainCamera MyScript Component
Interact with the Example
Position Vector
Vector Defined by Two Points
Details of MyScript
Region: Visualization On/Off
Region: Position Vector
Region: Vector from Two Points
Take Away from This Example
Vector Algebra: Scaling
Normalization of Vectors
Direction of Vectors
The Vector Scaling and Normalization Example
Examine the Scene
Analyze MainCamera MyScript Component
Interact with the Example
Scaled Vector
Normalized or Unit Vector
Position Vector from Direction and Magnitude
Summary of Interaction
Details of MyScript
Visualization On/Off
Vector Va
DrawScaledVector
DrawUnitVector
DrawPositionVector
Take Away from This Example
Application of Vector: Velocity
The Velocity and Aiming Example
Examine the Scene
Analyze MainCamera MyScript Component
Interact with the Example
Details of MyScript
Process the Explorer
Process the Agent
Take Away from This Example
Vector Algebra: Addition and Subtraction
Rules of Vector Addition and Subtraction
Addition and Subtraction with the Zero Vector
Vectors in an Equation
Geometric Interpretation of Vector Addition and Subtraction
Vector Addition
Commutative Property of Vector Addition
Vector Subtraction
The Vector Add and Sub Example
Examine the Scene
Analyze MainCamera MyScript Component
Interact with the Example
Vector Addition and the Commutative Property
Vector Subtraction
Position Vector
Details of MyScript
Take Away from This Example
Application of Vector Algebra
The Windy Condition Example
Examine the Scene
Analyze MainCamera MyScript Component
Interact with the Example
Details of MyScript
Take Away from This Example
Summary
Chapter 5: Vector Dot Products
Introduction
Vector Dot Product: Relating Two Vectors
Definition of Vector Dot Product
Properties of Vector Dot Product
The Angle Between Two Vectors
The Angle Between Vectors Example
Examine the Scene
Analyze MainCamera MyScript Component
Interact with the Example
Details of MyScript
Take Away from This Example
Vector Projections
The Vector Projections Example
Examine the Scene
Analyze MainCamera MyScript Component
Interact with the Example
Details of MyScript
Take Away from This Example
Representation of a Line Segment
Inside-Outside Test of a General 1D Interval
The Line Interval Bound Example
Examine the Scene
Analyze MainCamera MyScript Component
Interact with the Example
Details of MyScript
Take Away from This Example
Line to Point Distance
The Line to Point Distance Example
Examine the Scene
Analyze MainCamera MyScript Component
Interact with the Example
Details of MyScript
Take Away from This Example
Line to Line Distance
The Line to Line Distance Example
Examine the Scene
Analyze MainCamera MyScript Component
Interact with the Example
Details of MyScript
Take Away from This Example
Summary
Vector Dot Product Definition and Implications
Interpreting the Dot Product Results
Insights into the Subtended Angle
The Line Equations
Chapter 6: Vector Cross Products and 2D Planes
Introduction
3D Coordinate System Convention
Unity Follows the Left-Handed Coordinate System
Vector Cross Product: The Perpendicular Direction
Definition of Vector Cross Product
Geometric Interpretation of Vector Cross Products
Properties of Vector Cross Product
The Vector Cross Products Example
Examine the Scene
Analyze MainCamera MyScript Component
Interact with the Example
Details of MyScript
Take Away from This Example
The Vector Plane Equation
The Position Pn on a Plane
Given a Position on a Plane
Positions on 2D Planes
The Vector Plane Equations Example
Examine the Scene
Analyze MainCamera MyScript Component
Interact with the Example
Details of MyScript
Take Away from This Example
Axis Frames and 2D Regions
Bounds on a 2D Plane
The Axis Frames and 2D Regions Example
Examine the Scene
Analyze MainCamera MyScript Component
Interact with the Example
Details of MyScript
Take Away from This Example
Projections onto 2D Planes
The Point to Plane Projections Example
Examine the Scene
Analyze MainCamera MyScript Component
Interact with the Example
Details of MyScript
Take Away from This Example
Line to Plane Intersection
The Line Plane Intersections Example
Examine the Scene
Analyze MainCamera MyScript Component
Interact with the Example
Details of MyScript
Take Away from This Example
Mirrored Reflection Across a Plane
The Reflection Direction
The Line Reflections Example
Examine the Scene
Analyze MainCamera MyScript Component
Interact with the Example
Details of MyScript
Take Away from This Example
Summary
Chapter 7: Conclusion
The Final Comprehensive Example
Examine the Scene
Analyze MainCamera MyScript Component
Interact with the Example
Interact with the Aiming System
Interact with the Agent
Interact with the Plane
Interact with the Shadow
Interact with the Reflection
Interact with the Colliding Treasure
Summary of Interaction
Details of MyScript
Step 0: Initial Error Checking
Step 1: The Aiming System
Step 2: The Agent
Step 3: The Plane
Step 4: The Shadow
Step 5: The Reflection
Step 6: The Collision with Treasure
Take Away from This Example
What’s Next
Index