Skip to content
New issue

Have a question about this project? # for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “#”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? # to your account

AngleToVector2Direction the conversion is not conventional #539

Open
fight4dream opened this issue Apr 22, 2021 · 1 comment
Open

AngleToVector2Direction the conversion is not conventional #539

fight4dream opened this issue Apr 22, 2021 · 1 comment

Comments

@fight4dream
Copy link
Contributor

my intuition of it is given an angle, say DoTransform(30degs), it will output Transformed(Vector2( cos(30degToRad), sin(30degToRad) ))
after wired things up, i discover it isn't. so the code says:

  1. there is an internal 'currentAngle', we'll increment it by the input angle every time we call transform,
  2. the direction is normalized by 1f / Mathf.Max(Mathf.Abs(Direction.x), Mathf.Abs(Direction.y));

so i guess it is made this way because of input axis prefab needed this kind of manipulation,
but comparing this component among others, it shouldn't have incremented a hidden angle,
some components that provides increment feature would have both Set() and Increment()

also the special normalization would better be another component's duty

@thestonefox
Copy link
Member

Is this a bug report or a feature request?

If it's a bug report then provide steps to reproduce with expected and actual

If it's a feature request the provide outline of the benefit of the feature

# for free to join this conversation on GitHub. Already have an account? # to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

2 participants