This site uses strictly necessary cookies. More Information

X- Home /

# Vector math: When forward,up,and right are certain values, a part of my model is at (0,1,0). How do I calculate that?

I know that when my object is sitting in a certain way, a specific part is on the (0,1,0) vector. I know what all 3 transform vectors (forward, right, and up) are at that given time. Knowing these 4 vectors at that specific time, it seems to me that I should be able to do some sort of vector math such that I can determine the vector for that specific part at any given time. So if I draw a ray during Update, I can have it ALWAYS pass through the specific point on my model (ignoring rounding errors). But I can't work it out.

Is it possible, or is there some sort of flaw in my logic?

For specifics, I know that when the three axes are:

forward: (0.873,-0.333,0.356)

right: (-0.172,0.471,0.865)

up: (-0.456,-0.816,0.354)

the vector I need to aim down is (0, 1, 0).

How do you know which point you need to connect to?

At a glance, it seems to me that TransformPoint might be the way to go. You could use it to build a Ray that begins at the pivot point and travels through your target.

I just know by looking at the model. The particular example I am using is a 4-sided die. When the die sits flat on one side, a particular corner is straight up.

I had a really long comment about not knowing what to transform by and that maybe my problem was working in world space ins$$anonymous$$d of object space. Then I looked up doing that conversion and realized that's what TransformPoint was for. I'll look into using that and see what I come up with.

That did it, thanks. $$anonymous$$y ray is now firing out exactly where it is supposed to, regardless of the object orientation.

### Your answer

### Welcome to Unity Answers

The best place to ask and answer questions about development with Unity.

To help users navigate the site we have posted a site navigation guide.

If you are a new user to Unity Answers, check out our FAQ for more information.

Make sure to check out our Knowledge Base for commonly asked Unity questions.

If you are a moderator, see our Moderator Guidelines page.

We are making improvements to UA, see the list of changes.