This commit is contained in:
CortexCore
2023-11-06 01:17:23 +08:00
parent bd40165ade
commit 5446067f91
114 changed files with 2023 additions and 414 deletions

View File

@@ -24,12 +24,15 @@ namespace BITKit.Physics
[SerializeField] private Optional<ConfigurableJointMotion> overrideMotion;
[SerializeField] private Optional<ConfigurableJointMotion> overrideAngularMotion;
private void Start()
{
foreach (var x in jointConfigures)
{
x.InitialRotation=x.animate.localRotation;
x.InitialRotation= x.animate.localRotation;
if (x.animate.localRotation != x.joint.transform.localRotation)
{
BIT4Log.Log<PhysicsBasedAnimation>($"{x.animate.name}初始旋转与关节旋转不一致,将会导致动画不正确");
}
}
}
private void FixedUpdate()
@@ -45,12 +48,10 @@ namespace BITKit.Physics
{
jointConfigure.joint.angularXDrive = drive;
jointConfigure.joint.angularYZDrive = drive;
// jointConfigure.joint.targetRotation =
// Quaternion.Lerp(
// Quaternion.identity,
// Quaternion.Inverse(jointConfigure.animate.localRotation) * jointConfigure.InitialRotation,
// Blend
// );
jointConfigure.joint.xDrive = drive;
jointConfigure.joint.yDrive = drive;
jointConfigure.joint.zDrive = drive;
jointConfigure.joint.targetRotation = Quaternion.Inverse(jointConfigure.animate.localRotation) *
jointConfigure.InitialRotation;
jointConfigure.joint.targetPosition = jointConfigure.animate.localPosition;

View File

@@ -9,6 +9,7 @@ namespace BITKit
{
public static async UniTask AddForceAtPositionAsync(this Rigidbody rigidbody, Vector3 force, Vector3 position,ForceMode forceMode=ForceMode.Force)
{
if (rigidbody is null) return;
await UniTask.DelayFrame(8);
try
{