How to do it...

  1. Create a new Actor class using the editor wizard. Call it AntiGravityVolume:
  1. Update the header file to add a BoxComponent to the new Actor and two virtual functions:
#pragma once#include "CoreMinimal.h"#include "GameFramework/Actor.h"#include "Components/BoxComponent.h"#include "AntiGravityVolume.generated.h"UCLASS()class CHAPTER_07_API AAntiGravityVolume : public AActor{    GENERATED_BODY()    public:     // Sets default values for this actor's properties    AAntiGravityVolume();protected:    // Called when the game starts or when spawned    virtual void BeginPlay() override;public:     // Called every frame virtual void Tick(float DeltaTime) ...

Get Unreal Engine 4.x Scripting with C++ Cookbook - Second Edition now with the O’Reilly learning platform.

O’Reilly members experience books, live events, courses curated by job role, and more from O’Reilly and nearly 200 top publishers.