- Home /
How to get a point along an object x distance away from its pivot
I have an object which has an anchor point or pivot on the middle right. At any given time I want to know what the Vector3 position is of the object's middle left. Like this:
As you can see, let's say for example the pivot/anchor is at (7.3, 10.4, 0). I want to know what the Vector3 point is of where the blue star is. I know that the width of this object is 0.4f units wide.
What is the formula needed to calculate this point? I have a feeling it's got something to do with using transform.right? no?
wat is your purpose actually??
transform.right * width;
or you can normailze the angle of object and multiply by -width.
Answer by mattyman174 · Feb 21, 2014 at 06:32 AM
transform.right * 0.4f; // Right
-transform.right * 0.4f; // Left
In my test case my transform.right is (0.7, 0.7, 0) and the width is 0.6720001. The anchor position is the same
(0.7, 0.7, 0) * 0.6720001 gives me (0.5, 0.5, 0) which is not the right answer
edit: actually, I get it, I have to subtract this amount from the knife's anchor position. Thanks