Author Topic: Opposite Of VectorDist  (Read 1027 times)

Is there any function that returns the opposite of vectorDist or is there any way I can take the result of vectorDist and reverse it?

Also, does anyone know the default shape name distance or how to get a player's shape name distance?
« Last Edit: February 09, 2013, 08:41:07 AM by jes00 »

Is there any function that returns the opposite of vectorDist or is there any way I can take the result of vectorDist and reverse it?
What do you mean?

What exactly is the opposite of a distance?

vectorSub("0 0 0", -your vector-)?

or use vectorScale with -1

What do you mean?
The number vectorDist returns goes up the farther you move away from your target. I want a function that goes down the farther you move away from your target.

The number vectorDist returns goes up the farther you move away from your target. I want a function that goes down the farther you move away from your target.
You mean like closer to 0, or closer to -∞ ?

The number vectorDist returns goes up the farther you move away from your target. I want a function that goes down the farther you move away from your target.
Do some math, depending on where you want zero to be

200 - %vectorDist would put the zero at 200 units away
If you want it to be non-linear, do 200 / vectorDist% (You probably shouldn't use this)

You mean like closer to 0, or closer to -∞ ?
When you are where your target is I want it to return 1 and when your farther away I want it to return 0.whatever going down to 0 when you move far away enough. And than it does not go into negatives. It just goes to 0.

When you are where your target is I want it to return 1 and when your farther away I want it to return 0.whatever going down to 0 when you move far away enough. And than it does not go into negatives. It just goes to 0.
then you can use the formula 1/distance for that.

This is where math comes into play.

mClampF( 1 - limit / vectorDist( vec1, vec2 ), 0, 1 )

mClampF( 1 - limit / vectorDist( vec1, vec2 ), 0, 1 )
what is limit for?

what is limit for?
The distance before the value stays at 0.

Aha! A picture to describe what I need.