# How to align object to a vector

I have two cubes (Cube1 and Cube2) and I am positioning an icosphere by adding the two vectors of the former cubes. I then scale the icosphere's vector by 0.5 so that it sits visually between the two cubes.

What I really want is for it to sit between the two cubes on the green vector so that I can move it between the two cubes. I noticed that the icosphere moves on its local axis rather than world axis.

I have read a lot about vectors and matrices etc. and still find it difficult to understand sometimes.

So my questions are, how would I get my icosphere to use the green vector for its position, and if possible explain why it only moves in local space rather than world space, and is it even possible to move it in world space so its pivot point moves with it?

[Fun fact: every answer needs at least 30 characters. Markup symbols don't count.]

• Interesting use of the mix node, didn't expect this
– Neil
Feb 18, 2022 at 14:26
• @Neil take a look at this answer by Marty Fouts, which effectively is a list of vector formulas you can replace with the Mix RGB node. Feb 18, 2022 at 14:40
• FYI the character limit is there to enforce at least a bit of explanation if you post only a video. Some people with disabilities or with very slow internet connection have trouble with gifs :) Feb 18, 2022 at 15:04
• @Neil every vertex has a coordinate. Those coordinates, as well as connections between vertices (and some other attributes like smooth shading or material slot) define a mesh. An object is a wrapper of a mesh, that allows you to add stuff like rotation, scale, translation (location), parenting, constraints... matrix_world is the result transformation matrix that is applied to each vertex coordinate in order to evaluate the real coordinate. Feb 18, 2022 at 17:06
• @Neil correct, geometry nodes modify geometry. They have access to object properties, but can't modify it. position of the origin is an object property (location), so you can't modify it in geometry nodes. Feb 21, 2022 at 17:04

I'm not entirely certain if this is what you wanted but this does what you described.

https://giant.gfycat.com/ScientificShockingCarpenterant.mp4

Here's the node tree

and if you want it to go 0-1 you can just put a map range

• I guess this goes in the right direction. Although if I see it correctly, the scaling seems to be a bit weird... I understand the question like with scale 0 the icosphere should be at cube 1 for example, at scale 1 it should be at cube 2. So that the path between the cubes is always from 0 to 1 so that a scale of 0.5 is the exact center between those cubes. Right now it looks a bit different but I'm not sure. Unfortunately I have no time now to test it, but maybe my comment can help you tweaking your setup (if it's not already doing what I describe and I just didn't realize it). Feb 18, 2022 at 13:58
• Just throw a map range in front if you want it between 0-1. I'll edit Feb 18, 2022 at 14:08
• Thank you, I'll take a look at this later. Would you be able to answer my question on local v world space also?
– Neil
Feb 18, 2022 at 14:12