Home

Published

- 1 min read

How to find the two parts of a vector 2 C++

img of How to find the two parts of a vector 2 C++

The solution for this is noted below

How to find the two parts of a vector 2 C++

Solution

   // Our Vector2
Vector2 vec{1, 2};

// The first element of the vector
randomFunctionA(vec.x);

// and the second element of the vector
randomFunctionB(vec.y);

// The same goes for a vector3 but you use a z for the third element

Try other methods by searching on the site. That is if this doesn’t work