I am trying to make a flight simulator and to add lift and drag properly I need the angle of attack of the airplane which is defied as : Angle between the chord line of the wing and the velocity of the aircraft .

At first I thought this is pretty straightforward , just the angle between forward vector and the velocity vector, this is how I defined my AngleOfAttack

```
aoa = Vector3.Angle(transform.forward , rb.velocity)
```

then I found somewhere that this method is wrong, this is what the person wrote :

```
Vector3.forward and rb.velocity are both in world-space. AoA is the angle between the local chord-line of your wing and the aircraft's velocity.
Vector3.Angle will return an unsigned angle. AoA must work in both positive and negative directions otherwise negative pitch and inverted flight would not be possible.
```

and to provide the solution , this is what he wrote :

```
Solution: Move rb.velocity to local-space and solve for AoA with trigonometry.
// *flip sign(s) if necessary*
var localVelocity = transform.InverseTransformDirection(rb.velocity);
var angleOfAttack = Mathf.Atan2(-localVelocity.y, localVelocity.z);
```

This is what I don’t understand , If I’m measuring the velocity of an object , relative to its own space it should be always zero . Right ? How does InverseTransformDirection work here .