playMaker

Author Topic: How to compare Vector3 ? (SOLVED)  (Read 2490 times)

Stain Corb

  • Junior Playmaker
  • **
  • Posts: 74
How to compare Vector3 ? (SOLVED)
« on: February 04, 2020, 03:49:10 PM »
I have been at this for a couple of days and its driving me crazy. I need to be able to compare a Vector3 some how.

Basically I need to know if Say X is any value = Negative or Positive.

1-I tried converting Vector3 to string, then String To Float, it gives me an error from Float convert to INT, So I cant test it with (Int compare)

2-There is no Vector3 Compare Grater/Lower, Only Equals/NotEquals

3-There is no Vector3 convert to Int or Float.

At this point what can I do. ??
« Last Edit: February 04, 2020, 09:44:57 PM by Stain Corb »

Thore

  • Sr. Member
  • ****
  • Posts: 480
Re: How to compare Vector3 ?
« Reply #1 on: February 04, 2020, 04:36:07 PM »
You can extract the values, which are 3 floats, with a Get Vector XYZ actions and also write them back with Set Vector XYZ.

You can them run the value through a float compare. Alternatively, C# has a way to check the sign (+/-) based on mathf.sign and that returns a bool (e.g. true if positive) There’s probably action for this (look for “sign”).

I also find the access to floats inside the vector convoluted and it would be nice if there was a convert-style way to get/set them as individual floats. But to be fair, that’s also quite annoying in code.
« Last Edit: February 04, 2020, 08:47:09 PM by Thore »

Stain Corb

  • Junior Playmaker
  • **
  • Posts: 74
Re: How to compare Vector3 ? (SOLVED)
« Reply #2 on: February 04, 2020, 05:09:47 PM »
Thanks a lot, this one skipped me, So many actions to go trough, so many days looking :(.

But Get Vector3 XYZ solved the problem, Thanks.