UPDATE: I think I have figured out the problem, hopefully nobody bothered to read my post yet
One issue was that the tick group set in the sprungwheel blueprint seems to override what is set in the code. After I fixed that it looked like the tank was not moving at all, but in reality it was just not applying enough force. I’m still working on it, but should be able to resolve it now. Thanks!
Hello, I have really enjoyed the class and hope you can help me solve this issue I’m having with the Tick Group. I have tried everything I can think of to solve it myself, but no luck so far
I am using UE 4.21.1 so I’m guessing maybe something changed to cause it not to work? I’ve poured over the Tick docs but don’t see anything in particular that is different than you showed.
When I log out the GetWorld()->TickGroup in the SprungWheel tick function, it is always set to TG_PostPhysics, so the throttle always gets reset to 0 and the tank never moves. As you can see in the constructor I am setting PrimaryActorTick.TickGroup = TG_PostPhysics and I also set this in the blueprint.
Thanks so much for your help, this is driving me crazy!
I added this define I found on google in SprungWheel.h to help me print the value
of the TickGroup Enum:
#define GETENUMSTRING(etype, evalue) ( (FindObject<UEnum>(ANY_PACKAGE, TEXT(etype), true) != nullptr) ? FindObject<UEnum>(ANY_PACKAGE, TEXT(etype), true)->GetEnumName((int32)evalue) : FString("Invalid - are you sure enum uses UENUM() macro?") )
ASprungWheel::ASprungWheel()
{
// Set this actor to call Tick() every frame. You can turn this off to improve performance if you don't need it.
PrimaryActorTick.bCanEverTick = true;
PrimaryActorTick.TickGroup = TG_PostPhysics;
...
void ASprungWheel::Tick(float DeltaTime)
{
Super::Tick(DeltaTime);
UE_LOG(LogTemp, Warning, TEXT("current tick group: %s"), *GETENUMSTRING("ETickingGroup", GetWorld()->TickGroup));
if (GetWorld()->TickGroup == TG_PostPhysics) // this is ALWAYS true for some reason??
{
UE_LOG(LogTemp, Warning, TEXT("settting force back to 0 %f"), GetWorld()->GetTimeSeconds());
TotalForceMagnitudeThisFrame = 0;
}
}