can't use < or > for vector3

hello people,

i got a problem with this code

if(pos < end)

pos and end are to variables of type vector3.

but it gives this error,
Assets/basic_move_script_v2.cs(24,24): error CS0019: Operator <' cannot be applied to operands of type method group’ and `method group’

could some one help me out with this

thanx

Well not really sure what you mean by a 3D vector being “less” than another. Do you mean the length of the vectors?

if (pos.magnitude < end.magnitude)

// note sqrMagnitude would be faster

Or each element?

if(pos.x < end.x pos.y < end.y pos.z < end.z)

etc.

i mean that he has to check the hole vector3 with the other, to check if pos is before end.

thanx it works :slight_smile:

You betcha :slight_smile: