【发布时间】:2017-08-07 10:13:35
【问题描述】:
基本上,我想增加一个对象的 Z 轴每个刻度。我可以在蓝图中做到这一点,但我似乎无法弄清楚如何从滴答声中访问类的开始播放部分并增加 ActorLocation。
// Fill out your copyright notice in the Description page of Project Settings.
#include "MoveUp.h"
#include "GameFramework/Actor.h"
// Sets default values for this component's properties
UMoveUp::UMoveUp()
{
// Set this component to be initialized when the game starts, and to be ticked every frame. You can turn these features
// off to improve performance if you don't need them.
PrimaryComponentTick.bCanEverTick = true;
// ...
}
// Called when the game starts
void UMoveUp::BeginPlay()
{
Super::BeginPlay();
AActor* Owner = GetOwner();
FVector ActorLocation = FVector(0.f,0.f,200.f);
Owner->SetActorLocation(ActorLocation, false) ;
}
// Called every frame
void UMoveUp::TickComponent(float DeltaTime, ELevelTick TickType, FActorComponentTickFunction* ThisTickFunction)
{
Super::TickComponent(DeltaTime, TickType, ThisTickFunction);
// ...
}
【问题讨论】:
标签: c++ unreal-engine4