Transform Manipulations for Dummies
Do you like math? Do you like vectors? Do you want to know how to do vector math with transforms?
"But why would you even want to know this?"
On avatars, we dont have the luxuries of using scripting to make cool things.
So we can have to use the tools that are given to us to do fun things :)
And because a large portion of what makes games work is vector math, you can do a lot of fun things with this on avatars, like tracking other players' hands!
Chapter 0: What?
Prerequisites & Disclaimers
I expect you to know how to use the Unity Editor and to know a little bit about vector math and g...
What is a Transform?
A transform is a component that is attached to a GameObject. In fact transforms are the only type...
How do you do maths with a Transform?
For doing maths with transforms there are three primarily interesting things stored in a transfor...
Position Constraints
Position Constraints are Unity built-in Components that will copy the world-space position of a s...
World Space vs Local Space
As a lot of people have already explained this concept I will just refer to this post for brevity...
Chapter 1: Basic Operations
Multiplying a Vector by a Scalar
To multiply a vector by a scalar we can use the fact that when a position constraint is given a s...
Inverting a Vector
This can be done with the same method as Multiplying a Vector by a Scalar by simply using -1 as t...
Adding two Vectors
To add two vectors we have to get a little creative. I wont explain why this trick works mathemat...
Subtracting two Vectors
To subtract two vectors you can use the same method as Adding two Vectors but inverting either ve...
Normalizing a Vector
To normalize a vector we can use the LookAtConstraint. Make it look at the vector i.e. transform ...
What about dividing a vector by a scalar?
Unfortunately I currently do not know of any method to find the multiplicative inverse of an arbi...
Projecting a Vector (in World-Space)
To project a vector in world-space, you can simply use a position constraint, and only have one (...