任务:实现物体沿着二阶贝塞尔曲线运动
原理介绍参考链接:贝塞尔曲线 总结_PlayBoy's 部落格-CSDN博客_贝塞尔曲线
关键代码如下:
BezierCurve.h
// Fill out your copyright notice in the Description page of Project Settings.
#pragma once
#include "CoreMinimal.h"
#include "GameFramework/Actor.h"
#include "BezierCurve.generated.h"
UCLASS()
class DATALEARN_API ABezierCurve : public AActor
{
GENERATED_BODY()
public:
// Sets default values for this actor's properties
ABezierCurve();
protected:
// Called when the game starts or when spawned
virtual void BeginPlay() override;
public:
// Called every frame
virtual void Tick(float DeltaTime) override;
private:
void SetMeshToBezierCurve(double curTime);
public:
UPROPERTY(EditAnywhere, BlueprintReadWrite, Category = "NPC|BezierCurve")
class