AnnulusGames / LitMotion

Lightning-fast and Zero Allocation Tween Library for Unity.
https://annulusgames.github.io/LitMotion/
MIT License
841 stars 66 forks source link

Add the functions that take Vector2 as input into LitMotionTransformExtensions.cs for 2D games. #119

Closed qwe321qwe321qwe321 closed 8 months ago

qwe321qwe321qwe321 commented 8 months ago

Add BindToPositionXY, BindToPositionXZ, BindToLocalPositionXY, BindToLocalPositionXZ, BindToLocalScaleXY, BindToLocalScaleXZ to LitMotionTransformExtensions.cs.

It is quite common to use Vector2 for position and scale when making 2d games, and there are no relevant function available for that purpose. The Vector3 functions are not suitable since we do not want to change the z-component value when using these functions. The casting cost is also a concern.

AnnulusGames commented 8 months ago

It looks good. In this case, it would be better to have a YZ combination as well. (I don't know if it will actually be used, but it would be better to have it considering the symmetry of the API.)

AnnulusGames commented 8 months ago

It might also be a good idea to add similar extension methods to eulerAngles and localEulerAngles.

qwe321qwe321qwe321 commented 8 months ago

Hello, I added YZ and eulerAngle methods. I also added unit tests for those methods.

AnnulusGames commented 8 months ago

Merged the PR. Thanks!