UMG animations not moving CreatureWidgets : expected?

Discuss issues pertaining to the various game/web runtimes of Creature here.
Post Reply
callybee
Posts: 1
Joined: Mon Nov 02, 2020 6:41 pm

UMG animations not moving CreatureWidgets : expected?

Post by callybee » Mon Nov 02, 2020 6:45 pm

Using an anchor point, no meta - just one default animation.
Tick is being called; and it animates just fine when the screen is shown : but when the parent object is translated in an animation; the creature widget sits still!
Feature request? any guidance on implementing it myself? Happy to jump on & contribute to the open source plugin.

chong
Posts: 1178
Joined: Thu Feb 19, 2015 2:21 am

Re: UMG animations not moving CreatureWidgets : expected?

Post by chong » Mon Nov 02, 2020 11:23 pm

Hello,

The code for the widget is here:
https://github.com/kestrelm/Creature_UE ... Widget.cpp

I am guessing ( but you can take a look a the rest of the implementation ) the following lines might be useful for your reference:

Code: Select all

nt32 SCreatureWidget::OnPaint(
    const FPaintArgs& Args, 
    const FGeometry& AllottedGeometry,
    const FSlateRect& MyClippingRect, 
    FSlateWindowElementList& OutDrawElements, 
    int32 LayerId, 
    const FWidgetStyle& InWidgetStyle,
    bool bParentEnabled) const
{
	const_cast<SCreatureWidget *>(this)->UpdateMesh(
		AllottedGeometry.AbsolutePosition + (AllottedGeometry.GetAbsoluteSize() * 0.5f),
		AllottedGeometry.GetAbsoluteSize() * 0.02f);
	auto can_draw = render_brush && (render_data.VertexData.Num() > 0) && (render_data.IndexData.Num() > 0);
	if (can_draw)
	{
		FSlateResourceHandle Handle = FSlateApplication::Get().GetRenderer()->GetResourceHandle(*render_brush);
		const FSlateShaderResourceProxy * ResourceProxy = Handle.GetResourceProxy();
		if (ResourceProxy) {
			FSlateDrawElement::MakeCustomVerts(
				OutDrawElements,
				LayerId,
				Handle,
				render_data.VertexData,
				render_data.IndexData,
				nullptr,
				0,
				0);
		}
	}

    return LayerId;
}
See how: AllottedGeometry.AbsolutePosition + (AllottedGeometry.GetAbsoluteSize() * 0.5f)
is sent in as position. Maybe that can be useful for you there?

Thanks

Post Reply