Skip to content

Bounds don't update properly when Skeletal Mesh animation is used #47

@sirjofri

Description

@sirjofri

When the parent is a skeletal mesh component, the bounds of the parent are used in UGFurComponent::CalcBounds(). However, if the components don't change their position as it is the case if your animation doesn't move the root, the bounds aren't updated properly. This is due to some automatic bounds caching mechanism that is useful for static actors/components, but in our case, the component itself is static, but the animation is moving the visual representation.

Skeletal Mesh components take the physics asset into account for calculating the bounds, which works. However, UGFurComponent::CalcBounds() is (1) only called once due to the optimization I already mentioned, and (2) needs to apply for each frame.

I have a currently working solution by changing the bComputeBoundsOnceForGame property in the constructor to deactivate the optimization for this component:

UGFurComponent::UGFurComponent()
{
        bComputeBoundsOnceForGame = false;
}

Then it is also needed to compute the bounds per tick:

void UGFurComponent::TickComponent(float DeltaTime, enum ELevelTick TickType, FActorComponentTickFunction *ThisTickFunction)
{
        LastDeltaTime = DeltaTime;

        MarkRenderDynamicDataDirty();

        if (SkeletalGrowMesh && MasterPoseComponent.IsValid())
        {
                UpdateBounds();
                MarkRenderTransformDirty();
        }
}

However, I'm not an expert about rendering in Unreal, so maybe there's a better solution.

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions