I'm making a simple game in C#/XNA. My actors store the direction in which they intend to go as a Vector2
. At each update cycle, I normalize the heading (because of the way it's set can lead to different lengths) and add heading*Speed
to position to move the actor.
This seems inelegant. Logically, a direction has no length, it is of unit length by definition. Practically, the constant normalization has trivial extraneous computational cost.
- Is there a
NormalizedVector2
in XNA? - How do I go about creating one which is compatible with XNA's
Vector2
(ie can be added to it and so on)? ExtendVector2
and override theLength
property? - Are there larger conceptual problems with how I am trying to accomplish what I am trying to accomplish?