pafuhana1213 / KawaiiPhysics

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

WorldRotationのテレポートの判定条件 #8

Closed monguri closed 4 years ago

monguri commented 4 years ago

FAnimNode_KawaiiPhysics::EvaluateSkeletalControl_AnyThread()の以下のコードについて指摘させてください。

if (SkelCompMoveRotation.GetAngle() > TeleportRotationThreshold * TeleportRotationThreshold)
{
    SkelCompMoveRotation = FQuat::Identity;
}

角度の比較なので、TeleportRotationThresholdは2乗する必要がないように思いましたがいかがでしょうか。 また、GetAngle()はラジアン単位で返しますので、TeleportRotationThreshold は度で設定すると思いますので、単位の変換が必要なのではないかと思いました。 今まではラジアンなので小さな値が返っていてこの分岐内に入ることがほとんどなかったのでないかと推測しています。

pafuhana1213 commented 4 years ago

ご指摘ありがとうございます!以下のコミットで修正しました! https://github.com/pafuhana1213/KawaiiPhysics/commit/40b99cfcf81400d84641afde4e0017d93ef35f75

monguri commented 4 years ago

ありがとうございます!