Skip to content

Files

Latest commit

 

History

History

AActor

Folders and files

NameName
Last commit message
Last commit date

parent directory

..
 
 

AActor

Event BeginPlay

event_beginplay

.h File

protected:
	virtual void BeginPlay() override;

.cpp File

void AExampleActor::BeginPlay()
{
	Super::BeginPlay();

	// Your code here...
}

Event Tick

event_tick

Make sure that PrimaryActorTick.bCanEverTick is set to true in the constructor, so the tick function will be called.

.h File

public:
	virtual void Tick(float DeltaTime) override;

.cpp File

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

	// Your code here...
}

Set Actor Location

set_actor_location

AActor* ExampleActor;

FVector NewLocation;

ExampleActor->SetActorLocation(NewLocation);

Set Actor Rotation

set_actor_rotation

AActor* ExampleActor;

FRotator NewRotation;

// Convert FRotator to FQuat and set actor rotation
ExampleActor->SetActorRotation(FQuat::MakeFromRotator(NewRotation));

Set Actor Scale 3D

set_actor_scale_3d

AActor* ExampleActor;

FVector NewScale3D;

ExampleActor->SetActorScale3D(NewScale3D);

Set Actor Transform

set_actor_transform

AActor* ExampleActor;

FVector NewLocation;
FRotator NewRotation;
FVector NewScale3D;

// Create FTransform (rotation, location and scale)
FTransform NewTransform(NewRotation, NewLocation, NewScale3D);

ExampleActor->SetActorTransform(NewTransform);

Set Actor Hidden In Game

set_actor_hidden_in_game

AActor* ExampleActor;

bool bHideActor;

ExampleActor->SetActorHiddenInGame(bHideActor);

Destroy Actor

destroy_actor

AActor* ExampleActor;

ExampleActor->Destroy();