I am trying to use sign to determine my direction in 3d however when i try applying sign to my velocity :
"var direction = sign(velocity)"
however there is an error message saying "cannot convert argument 1 from Vector3 to float"
sign function needs float param type float sign(s: float) Your velocity type is Vector3, not float. It returns -1 or 0 or 1.
sign
float sign(s: float)
AspireMint thx, that helped a lot
You could use sign() on one of the components of velocity, e.g. sign(velocity.x).
Sign of a vector doesn't make sense. You probably want the sign of the dot product.
If you do a dot of two vectors and they are the same, it's 1.0 and if they are exact opposite -1.0 (and 0.0 if perpendicular).