# Problem in mathematics [solved]

`start` and `end` are two vectors. and this is a vector between them.
`Preformatted text(start.add(end)).mult(0.5f);`

but I need a new vector that be in 0.2 of distance between these two vectors . and changing 0.5 to 0.2 does not work.

I think that the only reason 0.5 works in your case (but 0.2 doesnâ€™t) is because 0.5 is also conveniently the average, where as multiplying by 0.2 is going to return an unrelated vector that is slightly closer to (0, 0, 0) and not between the 2 at all.

You could also use the interpolate method to do that instead

``````Vector3f vectorBetween = start.clone();
vectorBetween.interpolateLocal(end, 0.5f); // 0.2f
Preformatted text(vectorBetween);``````
1 Like

you need to get difference vector (it is via substract, for example (1,1,1) â†’ (3,3,3) then (2,2,2) is difference - but also care about negative numbers)
then you mult 0.2 from difference vector and add it to start vector again.

1 Like

You donâ€™t care about negative numbers, either. Just that you add the partial vector back to the source (and not the destination). You just have to keep things consistent.

Vector3f relative = dest.subtract(source);
relative.multLocal(someFraction);

Thatâ€™s it. I believe all of this is covered in the â€śmath for dummiesâ€ť link at the top of the forumâ€¦ because itâ€™s super basic vector stuff.

1 Like

by care i could mean anything like not using ABS. after this long time, you should know what people odd things can do

but yes, thats it, 3 lines of code.

1 Like

Have a look at the Vector3f Linear Interpolation method In FastMath

1 Like