- Home /

# Extending a vector?

Hi,

My problem is more of a basic vector maths problem then a scripting problem.

I want to be able to make a vector longer. I have a vector from the origin of one circle to the point of origin on another circle and I want to be able to use this vector to find an Extended vector represented in green of a different magnitude.

Does anyone have any ideas of how to do this?

Thank you in advance.

**Answer** by mikelo
·
Feb 10, 2016 at 11:24 AM

Multiply your vector by a scalar. Check this.

```
Vector3 extended_vector = your_vector * (float);
```

To extend it to a known magnitude, you can first normalize your original vector:

```
your_vector.Normalize();
Vector3 extended_vector = your_vector * the_magnitude_you_want;
```

**Answer** by Guhanesh
·
Feb 10, 2016 at 12:09 PM

//Let the bigger circle centre position be A and smaller circle position be B and Extended

// position be C

public float float ExtenDis=5;

Vector3 normVector = (A.position-B.position).normalized;

B.position=B.position*normVector*ExtenDis;

**Answer** by 5c4r3cr0w
·
Mar 12, 2016 at 02:43 PM

Okay lets say bigger circle has c1 center and smaller circle has center c2. So the direction will be c2 - c1 . Now you need to normalize vector so the magnitude becomes 1 and then multiply it with any digit so it can be extended to your desired position.

Here is some code :

```
public Transform c1, c2, res;
public float unit;
Vector3 result;
void Start ()
{
result = c2.position - c1.position;
res.position = result.normalized;
}
void Update ()
{
result = res.position * unit;
Debug.DrawRay (c1.position, result);
}
```

Tweak the value of unit so you get desired results.

Hope this helps

**Answer** by toddisarockstar
·
Mar 12, 2016 at 05:10 PM

you can simply subtract two vector threes to get direction. then simply add it to go past your second point.

```
var heading:Vector3;
var howfarpas:float;
howfarpast=.5;
var yournewspot:Vector3;
heading = target.position - player.position;
heading=heading*howfarpast;
yournewspot = target.position+heading;
```

### 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.