Point, arrow and rotation notes

A lot of moving around, placing and aiming can be done if you know simple vector math, rules for rotations/quaternions and can use some of the built-ins. Each problem is different -- this is hopefully enough theory that you can figure out most things, or understand someone else's vector/rotation code well enough to modify it.

This assumes you have a very basic knowledge of coding and know simple Unity3D navigation. Each section is only a few pages long.

 

Vectors and Rotations The whole thing as a pdf. 1/4th Meg. The links in the table of contents work.

 

  1. Basic terms pdf
  2. Point and offset math pdf
  3. Local/global axes pdf
  4. Direction & Magnitude pdf
  5. Rotation pdf
  6. Combining rotations pdf
  7. Moving points and rotations pdf
  8. More misc math pdf
  9. Local space trick pdf
  10. Examples pdf

 

Links to each chapter as html's

Contents

Contents
0 Intro
 0.1 Review of basics
1 Vectors and offsets
 1.1 Points and Offsets
 1.2 transform.position + offset
 1.3 Math review
2 Local and Global coordinates
 2.1 Local/global translate tools
 2.2 Using your local axis in code
 2.3 Intro to local space theory
 2.4 Other Unity commands and local coords
 2.5 Childing, localPosition
 2.6 Looking at the numbers
 2.7 Errors
 2.8 Bonus space-fighter example
3 Direction & Length
 3.1 Magnitude/distance
 3.2 Normalized direction + length
 3.3 Looking at the numbers
4 Rotations
 4.1 Quaternions
 4.2 Ways to make a rotation
 4.3 Details and math
5 Combining rotations
 5.1 Rotating an arrow
 5.2 Combining rotations
 5.3 Misc rotation combinations
 5.4 Z, global x, global y
6 Moving
 6.1 Speed per second
 6.2 MoveTowards
 6.3 Gradually rotating
 6.4 Misc, summary
7 Misc Math
 7.1 Trig you should never use
8 Using local space
 8.1 Local Space Theory
 8.2 Local to global math
 8.3 Bringing into local
 8.4 Round trip local space
 8.5 Misc problems
 8.6 Built-in shortcuts
 8.7 Summary
9 Misc examples
 9.1 Controlling your y-spin
 9.2 Getting your y-spin
 9.3 Align with ground
 9.4 Orbit camera
 9.5 Changing length of arrows
 9.6 Drawing a line between
 9.7 Connect two blocks

Comments. There's also a post in the Unity Teaching&Learning Forum.

Jan 10, 2017: in Rotation chapter; rewrite the Quaternion sections , fixes and small grammar changes elsewhere.

Nov, 2017: re-edit entire thing. Redo first rotation chapter; added connect-cubes to misc examples. Added entire-pdf-with-TOC and html chapters (htlatex can do that. Who knew? Well, everyone except me.)

Sept, 2018: re-re-edit entire thing