I'm currently playing around with XNA, and creating a simple 2D platformer. I was thinking of adding multiple layers to make it a little bit of challenge.
In stead of having a Vector2
for my positions, I now use a Vector3
, solely to use it's Z
as layer depth. However, since you can't use operators between Vector2
and Vector3
for some unknown reason [1], I ended up changing all other Vector2
s in my game, such as acceleration, speed and offset, so I can do things like position += offset
without errors.
I also changed my rotation variable from float
to Vector3
, and I use the Z
value to rotate my textures. I'm planning to use the X
and Y
to scale-flip my textures, so you get the Super Paper Mario effect.
However, after changing all these Vector2
s in Vector3
s, I felt a little bad about it. How does this effect the performance of games? I know I shouldn't have to worry about performance in my little platformer game, but I'm just curious about it.
Is there any notable performance between Vector2
s and Vector3
s, for example when adding or multiplying them, or when calling Normalize
, Transform
, or Distance
?
[1] Just a side question, why are there no operators for calculations between Vector3 and Vector2?