jp-sdt's picture

Vector3.Distance ??

Hi all,
Now I'm at a point, where I need a new method in OpenTK ^^
XNA have a ´Vector3-Method named Vector3.Distance(ref Vector3 val1, ref Vector3 val2. out float Distance);
It would be nice, if I could use this function in OpenTK the next time ^^
Or are there alternative usages for that?

Nice Reguards

JP-sdt
(sorry for my bad English :/ )


Comments

Comment viewing options

Select your preferred way to display the comments and click "Save settings" to activate your changes.
swiftcoder's picture

The distance between two vectors is the length of their difference, so (vec1 - vec2).Length should result in the same value.

jp-sdt's picture

I tried but the errorbox shows me that it isn't possible to convert float in Vector3.
here is an example how I used

Vector3 v3 = (new Vector3(1, 2, 1) - new Vector3(1, 1, 1)).Length;

greetings

jp-sdt's picture

XD uups
I see the reason now....
^^"

You're right...it works :)
thank you