pafuhana1213 / KawaiiPhysics

KawaiiPhysics : Simple fake Physics for UnrealEngine4 & 5
MIT License
1.92k stars 287 forks source link

AdjustByAngleLimit is not working properly #99

Closed dopieters closed 1 year ago

dopieters commented 1 year ago

I have noticed that the function AdjustByAngleLimit in _AnimNodeKawaiiPhysics.cpp is not working properly. The bug seems to be due to the use of the function RotateAngleAxis which rotate around a normalized vector. Currently the vector is not normalized. So it can be fixed by changing BoneDir = BoneDir.RotateAngleAxis(-AngleOverLimit, Axis); by:

const FVector AxisNormalized = Axis.GetSafeNormal();
BoneDir = BoneDir.RotateAngleAxis(-AngleOverLimit, AxisNormalized);
pafuhana1213 commented 1 year ago

Hi @dopieters ! I'm appreciate your report and great modified code!

I've committed https://github.com/pafuhana1213/KawaiiPhysics/commit/9a0576cfa06d37eb0c1b35f57757737ac61288b8 to fix this issue now.

Thanks!