Movable Platform

I did everything as the video showed but my platform is not moving, in the code below I tried moving PrimaryActorTick.bCanEverTick = true into BeginPlay and it also doesn’t move.

AMovingPlatform::AMovingPlatform()
{
SetMobility(EComponentMobility::Movable);
}

void AMovingPlatform::BeginPlay()
{
PrimaryActorTick.bCanEverTick = true;
}

void AMovingPlatform::Tick(float DeltaSeconds)
{
Super::Tick(DeltaSeconds);
FVector Location = GetActorLocation();
Location += FVector(15 * DeltaSeconds, 0, 0);
SetActorLocation(Location);
}

1 Like

Hi Wesley, I think you should change your constructer and beginplay methos as I showed below. Then replace your MovingPlatform component in level again.

Note: I could not find how to update older MovingPlatform components in level. If someone find the solution, please share it :slight_smile:

AMovingPlatform::AMovingPlatform()
{
PrimaryActorTick.bCanEverTick = true;
SetMobility(EComponentMobility::Movable);
}

void AMovingPlatform::BeginPlay()
{
Super::BeginPlay(); // your problem was that you forget this line
}

1 Like

Update them in which way?

1 Like

In order to understand Wesley’s problem, I changed my code as Wesley showed above. Then, my objects didn’t move anymore as expected. Then, I realized the problem and fix it but my older movement objects in the level didn’t move. I needed to replace all movement platforms in level again :frowning:

I couldn’t understand why older objects C++ code didn’t updated automaticly.

Did you try an editor restart?

Yes and also I tried clean and rebuild solution from visual studio but it doesn’t work. I think it is a bug about unreal engine. I tried with 4.22.3 version of unreal engine. Perhaps it is solved with new versions.

Some times these behaviours do happen!

This topic was automatically closed 24 hours after the last reply. New replies are no longer allowed.

Privacy & Terms