Moving Platform movements from A&B Points not Working?Goes through walls

Hi Class, I notice my moving platform is not moving back and forth to its A&B points. The Moving Platform actually goes through walls… Any feedback is welcomed :slight_smile:

We would need more info about what you’ve implemented to be able to help.

HI Sam, I posted the code I wrote following your instruction. What else would you need that I implemented?

#pragma once

#include "CoreMinimal.h"
#include "Engine/StaticMeshActor.h"
#include "MovingPlatform.generated.h"

/**
 * 
 */
UCLASS()
class AMovingPlatform : public AStaticMeshActor
{
	GENERATED_BODY()

public:
	AMovingPlatform();

	virtual void Tick(float DeltaTime) override;
	
	UPROPERTY(EditAnywhere)
	float Speed = 20;
	
};
#include "MovingPlatform.h"


AMovingPlatform::AMovingPlatform()
{
	PrimaryActorTick.bCanEverTick = true;

	SetMobility(EComponentMobility::Movable);
}

void AMovingPlatform::Tick(float DeltaTime)
{
	Super::Tick(DeltaTime);

	if (HasAuthority()) 
	{
		FVector Location = GetActorLocation();
		Location += FVector(Speed * DeltaTime, 0, 0);
		SetActorLocation(Location);
	}
}

Hi Sam, I posted the code as you wrote is there anything else you need me to post?

Your code hasn’t got any implementation for moving backwards and forwards. Why are you expecting that it should move back and forth?

because in the video you show it does move back and forth. is that instructions going to be in the next session? I keep working on it hopefully you get back to me.

Maybe you are seeing something different to me. The video only seems to show the platform move in one direction and through the wall just as you are observing.

1 Like

No worries I moved on in the class I’m in the next session which we are working on bring it back to point A. from B. :slight_smile:

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

Privacy & Terms