Using LibGDX Vector3 for storing non Vector data

I’ve been using Vector3 to store X-axis, Y-axis, and the rotation, of items in my game. I’m not using any of the other methods that this class provides.

Will this cause any performance issues?

Should I just made a small class that stores three floats, has three assessor methods, and three mutator methods?

How about three floats in your item class. It’s seems rather clunky that you use someVector.z as rotation anme instead of just rotation.

The answer is no. There is no way that it would cause performance issues :slight_smile:
Vector classes are often used to store all kinds of data, and they are not any slower to use than if you just defined a class that had xAxis yAxis and rotation. However, as (I think?) pitbuller was trying to point out, it might be more clear or more readable if you atored the data as members in your class with names that described their purpose.

Well, I’ve thought about that, but it’s not just that one Vector3 holding those three floats, there’s another Vector3 and a couple of Vector2, all holding different information.

Well I’d just create a wrapper class, called Rotation3f or something along those lines. You keep a nice name, but have all the functions like linear interpolation and stuff.

I made two classes, one stores XYZ positions, and the other stores two X positions and two Y positions. Both have getters and setters.

I’m making arrays of these two classes to store the information in, opposed to making a three or four dimensional array and grabbing the information.

The getters and setters make it easier to write my code as oppose to remembering that [0] is X and [1] is Y.

Is this good practice or should I avoid it?