Lancer
Member
|
Possible bug with EE::Angle()
Hi,
I'm not sure if this is a bug but this is weird and I can't explain why it happens.
So I have following code:
Code:
EE::Vec2 vLookDir = newPos.xz() - m_pActor->pos().xz();
Now to get the Angle of vLookDir I used the function:
Code:
EE::Angle(vLookDir)
but the result did not work.
Then I tried
Code:
EE::Angle(vLookDir.y, vLookDir.x)
And it works fine.
Results:
|
|
11-03-2020 03:48 PM |
|
Dwight
Member
|
RE: Possible bug with EE::Angle()
Hi,
At first glance, you're getting the angle between two xz coordinates. At the end, you're getting an angle between X and Y.
Was that intended or a typo?
|
|
11-03-2020 05:03 PM |
|
Lancer
Member
|
RE: Possible bug with EE::Angle()
(11-03-2020 05:03 PM)Dwight Wrote: Hi,
At first glance, you're getting the angle between two xz coordinates. At the end, you're getting an angle between X and Y.
Was that intended or a typo?
That's intended
|
|
11-03-2020 05:46 PM |
|
Tottel
Member
|
RE: Possible bug with EE::Angle()
If you're going to pass 2 params instead of 1, according to the documentation, you should first pass x and then y. The fact that you first pass y and then x, makes me think you construct your lookdir vector incorrectly.
Since it's a look direction, make sure you do
Code:
lookdir = posToLookAt - myPos
and not the other way around.
(This post was last modified: 11-04-2020 09:13 AM by Tottel.)
|
|
11-04-2020 09:13 AM |
|
Lancer
Member
|
RE: Possible bug with EE::Angle()
(11-04-2020 09:13 AM)Tottel Wrote: If you're going to pass 2 params instead of 1, according to the documentation, you should first pass x and then y. The fact that you first pass y and then x, makes me think you construct your lookdir vector incorrectly.
Since it's a look direction, make sure you do
Code:
lookdir = posToLookAt - myPos
and not the other way around.
I already do that.
My code is working fine in my game (client and server-side)
Here you can see:
Look1 - correct
Look2 & Look3 is wrong
|
|
11-04-2020 03:00 PM |
|
Esenthel
Administrator
|
RE: Possible bug with EE::Angle()
There's no bug.
You're just expecting different results.
|
|
11-04-2020 05:01 PM |
|