【问题标题】:How to rotate bones in UE4 with C++?如何使用 C++ 在 UE4 中旋转骨骼?
【发布时间】:2021-02-18 05:47:42
【问题描述】:

我只想创建一个简单地指定角色骨骼名称并旋转它的节点。

我想使用命名方法移动多个骨骼,而不仅仅是一个骨骼。

我写了以下代码。

MyCharacter.h

#pragma once

#include "CoreMinimal.h"
#include "GameFramework/Character.h"
#include "MyCharacter.generated.h"
class USkeletalMeshComponent;
class UPoseableMeshComponent;

UCLASS()
class TESTPLUGIN_API AMyCharacter : public ACharacter
{
    GENERATED_BODY()

public:
    // Sets default values for this character's properties
    AMyCharacter();
    FRotator RotationValue;

protected:
    // Called when the game starts or when spawned
    virtual void BeginPlay() override;

public: 
    // Called every frame
    virtual void Tick(float DeltaTime) override;

    // Called to bind functionality to input
    virtual void SetupPlayerInputComponent(class UInputComponent* PlayerInputComponent) override;

private:
    UPoseableMeshComponent* PoseableMesh;
};

MyCharacter.cpp

#pragma once

#include "CoreMinimal.h"
#include "GameFramework/Character.h"
#include "MyCharacter.generated.h"
class USkeletalMeshComponent;
class UPoseableMeshComponent;

UCLASS()
class TESTPLUGIN_API AMyCharacter : public ACharacter
{
    GENERATED_BODY()

public:
    // Sets default values for this character's properties
    AMyCharacter();
    FRotator RotationValue;

protected:
    // Called when the game starts or when spawned
    virtual void BeginPlay() override;

public: 
    // Called every frame
    virtual void Tick(float DeltaTime) override;

    // Called to bind functionality to input
    virtual void SetupPlayerInputComponent(class UInputComponent* PlayerInputComponent) override;

private:
    UPoseableMeshComponent* PoseableMesh;
};

当我编译上面的代码并用关卡蓝图打开它时,我看到了一个如下图所示的节点。

这个节点不是我想要的。

我想创建一个可以连接到 FinalAnimationPose 的节点,如下图所示。

如何创建这样的节点?

我想做的只是每秒旋转骨骼。我找不到此信息。

我是 UE4 和 C++ 的初学者。任何答案都会有所帮助。

【问题讨论】:

标签: c++ unreal-engine4


【解决方案1】:

我是 UE 的新手,但我认为这与 UE 社区中要求轮换的问题相同,但它是针对单个骨骼的:

这是链接:https://answers.unrealengine.com/questions/47930/how-to-rotate-bone-in-c.html

【讨论】:

  • 我也看到了那个页面。然而,即使我的代码使用了该示例中的 SetBoneRotationByName 函数,我的代码也没有显示连接到 FinalAnimationPose 的人形连接....
猜你喜欢
  • 2021-01-20
  • 2015-05-24
  • 1970-01-01
  • 1970-01-01
  • 1970-01-01
  • 2019-07-23
  • 2020-01-23
  • 1970-01-01
  • 2020-09-22
相关资源
最近更新 更多