zoukankan      html  css  js  c++  java
  • UE4笔记-Component相关问题记录

    记录UE4,Component的应用的一些问题.

    Q. 在UE4中往Actor/Pawn 中动态创建 Component与ChildActor 

    Note:旧版本的UE4 的Attach 和12.13版本有些不一样

    创建Component:

    UCpp_MyComponent* temp_imageCom = NewObject<UCpp_MyComponent>(this, UCpp_MyComponent::StaticClass());
    temp_imageCom->RegisterComponent();
    temp_imageCom->AttachToComponent(pParentComponent, FAttachmentTransformRules::KeepRelativeTransform);

    创建Actor Component:

    仅多了一步SetChildActorClass

    auto temp_childActorComponent = NewObject<UChildActorComponent>(this, UChildActorComponent::StaticClass());
    temp_imageCom->RegisterComponent();
    temp_childActorComponent->SetChildActorClass(*MyActorClass);
    temp_imageCom->AttachToComponent(pParentComponent, FAttachmentTransformRules::KeepRelativeTransform);

    删除函数:(命名真是迷)

    DetachRootComponentFromParent

    例如:

     Note:慎用此UChildActorComponent的动态生成方式

       父类Actor 的SetActorEnableCollision 方法,是不会影响 UChildActorComponent 的 GetChildActor()的,但是最搞笑的是当你调用父类Actor 的 SetActorHiddenGame 却会隐藏掉 UChildActorComponent 的 GetChildActor()。

       如果想通过UChildActorComponent的GetChildActor()对Actor进行Transform 操作的话不能采用Relative, 必须采用World 或者直接Transform Actor 的 ActorComponent

  • 相关阅读:
    Python 资源大全中文版
    Life is short.,You need Python
    哪些 Python 库让你相见恨晚?
    中国裁判文书网全网最新爬虫分析
    关于pycharm导入其他项目时出现找不到python无法运行的问题
    禅道项目管理软件配置及使用教程
    curl
    fusionpbx 中文 汉化
    kafka operation
    golang包管理工具——glide
  • 原文地址:https://www.cnblogs.com/linqing/p/5979939.html
Copyright © 2011-2022 走看看