The Vector2.Zero
property provides a static instance of a 2D vector where both the X and Y components are set to 0. This is useful for representing a neutral or origin point in 2D space.
The Vector2.Zero
property provides a static instance of a 2D vector where both the X and Y components are set to 0. This is useful for representing a neutral or origin point in 2D space.
Use Vector2.Zero
when you need a vector with no magnitude or when initializing vectors to a default state. It is a static property, so it can be accessed directly from the Vector2
class without creating an instance.
// Example of using Vector2.Zero Vector2 position = Vector2.Zero; // Check if a vector is at the origin if (position == Vector2.Zero) { // Do something if the position is at the origin }