Hello,
was following the guide below using UE4.24 and had to tweak to make it work as it should:
https://docs.unrealengine.com/en-US/…put/index.html
The “MyPawn1” object in the tree has a subchild below “RootComponent (Inherited)” called “OurVisibleComponent(Inherited)”
The guide tells that you should add a cylinder in the “Static Mesh” section but there is no such section.
I could manually select “RootComponent (Inherited)” then press “+Add Component”, “Static Mesh”
Then modify the code in AMyPawn::Tick to search for all child components until I find the static mesh node.
This is a real hack though but I thought it could be good to know that the c++ tutorial doesn’t work with the “Grow”-feature in UE4.24
Then a few includes are missing but I guess that’s easy to figure out by yourself
// Handle growing and shrinking based on our "Grow" action
{
FString s = "StaticMesh1";
for (int i = 0; i < RootComponent->GetNumChildrenComponents(); ++i)
{
USceneComponent* c = RootComponent->GetChildComponent(i);
FString str = c->GetName();
if (str.Equals(s)) {
float CurrentScale = c->GetComponentScale().X;
if (bGrowing)
{
// Grow to double size over the course of one second
CurrentScale += DeltaTime;
}
else
{
// Shrink half as fast as we grow
CurrentScale -= (DeltaTime * 0.5f);
}
// Make sure we never drop below our starting size, or increase past double size.
CurrentScale = FMath::Clamp(CurrentScale, 1.0f, 2.0f);
c->SetWorldScale3D(FVector(CurrentScale));
}
}
}
Cheers!