playMaker

Author Topic: Vector3 Round to Nearest  (Read 1691 times)

nuFF3

  • Beta Group
  • Junior Playmaker
  • *
  • Posts: 74
  • Are we even real?
    • One Month Studio
Vector3 Round to Nearest
« on: January 22, 2021, 07:16:35 AM »
Seeing as no one has made such an action before, I set out to make it myself.

I was actually surprised no one had made something like it, seeing as it's pretty useful for snapping positions, snapping rotation, rounding off strange 0.0001 values Unity sometimes gives, and so on.
I suppose one could do the same by splitting the vector3 up into separate float variables, rounding all those off, before putting them back into a vector3 again, but now you've got more clutter.
This action does that all in one action.

This action will let you round a vector3 variable to a nearest value, defined by a separate float variable.
The results are stored in a vector3 and/or separate float variables for XYZ if needed.
The results can be stored as variables or left open for debugging if needed.
Can be set to round to nearest only once, or every frame.

Hope this helps.

« Last Edit: January 22, 2021, 07:21:26 AM by nuFF3 »