1

I am trying to get the y value of a Vector3 (the camera), and i have looked at the documentation and haven't found a function to get a single value from the Vector3.

I have tried using it like a list, but that obviously doesn't work. I have found some C++ documentation, but i am using plain C, and I don't want to mess with C++. Thanks!

justtab
  • 23
  • 4

1 Answers1

1

A Vector3 is a typedef of a struct:

// Vector3, 3 components
typedef struct Vector3 {
    float x;                // Vector x component
    float y;                // Vector y component
    float z;                // Vector z component
} Vector3;

So you can access the y field as with any other struct. If my_vect3 is a Vector3 then you can access it with my_vect3.y, and if my_vect3_p is a pointer to a Vector3 you can access it with my_vect3_p->y.

ad absurdum
  • 19,498
  • 5
  • 37
  • 60