Skip to main content
Tweeted twitter.com/#!/StackGameDev/status/294792365871349761
added 186 characters in body
Source Link
Rudey
  • 453
  • 4
  • 11

Vector3 vs. Vector2 - performance, usage?

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 Vector2s in my game, such as acceleration, speed and offset, so I couldcan 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 Vector2s in Vector3s, 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 Vector2s and Vector3s, 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 adding or multiplying acalculations between Vector3 and a Vector2?

Vector3 vs Vector2 performance?

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, I ended up changing all other Vector2s in my game, such as acceleration, speed and offset, so I could do 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 Vector2s in Vector3s, 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 Vector2s and Vector3s, for example when adding or multiplying them, or when calling Normalize, Transform, or Distance?


Just a side question, why are there no operators for adding or multiplying a Vector3 and a Vector2?

Vector3 vs. Vector2 - performance, usage?

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 Vector2s 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 Vector2s in Vector3s, 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 Vector2s and Vector3s, 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?

added 186 characters in body
Source Link
Rudey
  • 453
  • 4
  • 11

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. So in

In stead of having a Vector2 for my positions, I now use a Vector3, andsolely to use theit's Z as layer depth. However, since you can't use operators between Vector2 and Vector3 for some unknown reason, I ended up changing all other Vector2s in my game, such as acceleration, speed and offset, so I could do position += offset without errors.

I also changed my rotation variable from float to a 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 Vector2s in Vector3s, 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 Vector2s and Vector3s, for example when adding or multiplying them, or when calling Normalize, Transform, or Distance?


Just a side question, why are there no operators for adding or multiplying a Vector3 and a Vector2?

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. So in stead of having a Vector2 for my positions, I use a Vector3, and use the Z as layer depth. However, since you can't use operators between Vector2 and Vector3 for some unknown reason, I ended up changing all other Vector2s in my game, such as acceleration, speed and offset.

I also changed my rotation float to a 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 Vector2s in Vector3s, 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 Vector2s and Vector3s, for example when adding or multiplying them, or when calling Normalize, Transform, or Distance?

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, I ended up changing all other Vector2s in my game, such as acceleration, speed and offset, so I could do 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 Vector2s in Vector3s, 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 Vector2s and Vector3s, for example when adding or multiplying them, or when calling Normalize, Transform, or Distance?


Just a side question, why are there no operators for adding or multiplying a Vector3 and a Vector2?

Source Link
Rudey
  • 453
  • 4
  • 11

Vector3 vs Vector2 performance?

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. So in stead of having a Vector2 for my positions, I use a Vector3, and use the Z as layer depth. However, since you can't use operators between Vector2 and Vector3 for some unknown reason, I ended up changing all other Vector2s in my game, such as acceleration, speed and offset.

I also changed my rotation float to a 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 Vector2s in Vector3s, 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 Vector2s and Vector3s, for example when adding or multiplying them, or when calling Normalize, Transform, or Distance?