CopyPoseFromMesh在有些情况会有一帧延时

我们做了个子部件挂在主mesh上,然后加了AddTickPrerequisiteComponent,蓝图里使用CopyPoseFromMesh,他在大部分情况下都会很好地跟随主mesh。

但是假如在混合物理,比如使用Physics Control,这时候子mesh就会跟主mesh有一帧的延迟了。

尝试过修改TickGroup,但是没用。除非在RegisterOnBoneTransformsFinalizedDelegate里面强制refresh一下。

请问是什么原因导致的呢?怎样解决。

您好,不好意思,我漏单了,一直没看到这个问题。我想问下您这边有没有开物理线程?感觉像是物理延迟了一帧计算。

您好,不知道你说的是哪个设置。

我看了下项目设置,substepping和tick physics async都是关闭的,应该就是默认设置。

Hi,不好意思,之前我们的Salesforce出了点问题,问题可能漏发过来了。我这里因为也不太能重现出来,我看了下代码以及一些我们内部的讨论,我觉得应该和USkeletalMeshComponent::EndPhysicsTickComponent这个函数里这段代码有关系:

// this used to not run if not rendered, but that causes issues such as bounds not updated // causing it to not rendered, at the end, I think we should blend body positions // for example if you're only simulating, this has to happen all the time // whether looking at it or not, otherwise // @todo better solution is to check if it has moved by changing SyncComponentToRBPhysics to return true if anything modified // and run this if that is true or rendered // that will at least reduce the chance of mismatch // generally if you move your actor position, this has to happen to approximately match their bounds if (ShouldBlendPhysicsBones()) { if (IsRegistered()) { BlendInPhysicsInternal(ThisTickFunction); } }​但是我没有找到能解决这个问题的方法。

仔细看了下,EndPhysicsTickFunction是一个独立的tick function,组件依赖的只是主tick,所以应该在组件copy完后再blend physics,然后就有误差了。我看看混合物理的时候改一下依赖看看。