I'll show you how you can use some basic math knowledge to manipulate points in 3D space. Knowing vectors and points will allow you to fully understand how objects are positioned, translated around, how matrices work, how quaternions are rotated, aim constrains calculated and much, much more.
First let me show you what we will be making and after that you will see how easy it is to make something like this:
The Zetz character is designed by Boris Stapic and the model and textures are from Seid Tursic.
This is made using Fabric Splice in Maya. Here is the download link for the splice file. Have fun with it. I will not cover the Splice part in this tutorial but you can go through my code and see how it is written. I also included some debuging code that draws the sphere.
I will be writing the tutorial in pseudo code, and everything might not be notated to mathematical standards. I'm trying to make everything easy to read and I leave it to you to figure out how to do it in the language and software of your choice.
So, here is what we are going to start with:
The origin is just the center of our world, radius is going to be an attribute that the user can modify, sphere center is the location of our sphere and the vertex position is what you will get from your application when you query the location of a vertex. This doesn't have to handle vertices, you can write a version that mirrors locators or any other objects.
Now we have to calculate a vector that will point from "c" to "a" so we know in what direction to mirror the object.
The next step is to make "a`" go from "c" to the spheres border. That is easy to achieve. We need to make "a`" a unit vector ( we set its length to 1 ) and we multiply that unit vector with the radius.
To know how far the mirrored point needs to be from the spheres center we need to calculate a multiplication factor. The factor is the number that we get when we divide the radius by the length of "a`". We will multiply "b" with this factor to get the position of our mirrored point.
Now we have our point mirrored and its location based on the sphere center. In order to get the location in the world we add up this vector to "c".
And that is how we go from "a" to "am". I leave it to you to write this in the software of your choice and if you have any further questions write them in the comments. But first make sure to try and figure everything out by yourself.
First let me show you what we will be making and after that you will see how easy it is to make something like this:
The Zetz character is designed by Boris Stapic and the model and textures are from Seid Tursic.
This is made using Fabric Splice in Maya. Here is the download link for the splice file. Have fun with it. I will not cover the Splice part in this tutorial but you can go through my code and see how it is written. I also included some debuging code that draws the sphere.
I will be writing the tutorial in pseudo code, and everything might not be notated to mathematical standards. I'm trying to make everything easy to read and I leave it to you to figure out how to do it in the language and software of your choice.
So, here is what we are going to start with:
The origin is just the center of our world, radius is going to be an attribute that the user can modify, sphere center is the location of our sphere and the vertex position is what you will get from your application when you query the location of a vertex. This doesn't have to handle vertices, you can write a version that mirrors locators or any other objects.
Now we have to calculate a vector that will point from "c" to "a" so we know in what direction to mirror the object.
The next step is to make "a`" go from "c" to the spheres border. That is easy to achieve. We need to make "a`" a unit vector ( we set its length to 1 ) and we multiply that unit vector with the radius.
To know how far the mirrored point needs to be from the spheres center we need to calculate a multiplication factor. The factor is the number that we get when we divide the radius by the length of "a`". We will multiply "b" with this factor to get the position of our mirrored point.
Now we have our point mirrored and its location based on the sphere center. In order to get the location in the world we add up this vector to "c".
And that is how we go from "a" to "am". I leave it to you to write this in the software of your choice and if you have any further questions write them in the comments. But first make sure to try and figure everything out by yourself.