# Transform a Vector from World Space To Local Space

# Objective: Transform a Vector from World Space To Local Space.

In the first step create a variable called worldCoord, then draw sphere using Gizmos using worldCoord.

The Second step is to find the displacement between worldCoord and **transform.position**, this will give us relative vector or displacement .We do this using new method needs to be created called WorldToLocal (a return type method).

Now we need to find the local cordinate of x and y ,we do this by assgning the the float variable to dot product of displacement and **transform.right** and assign float variable as y with dot product of displacement and **transform.up**

Now we return new Vector and we pass x and y as its parameter.

Create a vector called localCoord and assign it to the WorldToLocal method and pass worldCoord as a parameter.

Note: I make the localCoord as globe parameter for debugging.

This is how to transform Vector from world space to local space.

See you in the next one.