虚幻引擎:实例化静态网格体在实例化时不旋转
Unreal Engine : Instanced Static Mesh doesn't rotate on instanciation
我目前正在实时种植树木,并且我正在为叶子使用实例化静态网格体组件,因为每片叶子都是独一无二的。当我向组件添加叶实例时,我对其进行了随机旋转。但是由于某种原因,这种旋转没有设置,我所有的叶子都有一个零旋转器。比例已设置,变换也已设置,但未设置旋转。
这是代码:
//Instanced static mesh component instanciation, as a component of the tree
foliage = NewObject<UInstancedStaticMeshComponent>(this);
foliage->SetWorldLocation(GetActorLocation());
foliage->RegisterComponent();
foliage->SetStaticMesh(data->leaves[treeType]);
foliage->SetFlags(RF_Transactional);
this->AddInstanceComponent(foliage);
//Adding a instance of foliage
const FTransform leafTrans = FTransform(
FMath::VRandCone(normals[branches[i].segments[j].firstVertice + 2], 2.0f).Rotation(),
vertices[branches[i].segments[j].firstVertice + 2], FVector::ZeroVector);
foliage->AddInstance(leafTrans);
我最近更改了实例化静态网格体组件,我恳求将其放在一个儿童演员身上,旋转起作用了。但是我不得不为其他问题删除它。
我确定这是我错过的一件小事,但我浪费了太多时间在互联网上搜索,而且关于这个主题的文档并不多......
谢谢:)
好的,问题是规模。出于某种原因,如果将其设置为零,则还将旋转设置为零...
相关文章:
- 从C++实例化QML
- 设计一个只能由特定类实例化的类(如果可能的话,通过make_unique)
- 如何创建一个空的全局类并在启动时实例化它
- 在两个类中共享相同的函数调用,并在不需要时避免空实例化
- 约束和显式模板实例化
- 为什么包含windows.h会产生语法错误,从而阻止类的实例化?(C2146,C2065)
- 对象实例化调用构造函数的次数太多
- 如何使用非默认构造函数实例化模板化类
- 静态数据成员模板专用化的实例化点在哪里
- 错误的cv::face FacemarkLBF实例化
- C++的解析器在可以区分比较和模板实例化之前会做什么?
- 为什么 gcc 和 clang 为函数模板的实例化生成不同的符号名称?
- 检查某些类型是否是模板类 std::optional 的实例化
- 我有一个对象,它将在整个程序的持续时间内实例化,但一个类成员不会,我应该动态分配它吗?
- 无法使用 SWIG 在 Python 中实例化C++类(获取属性错误)
- 模板化类构造函数的模板实例化
- 在 c++ 中的模板实例化中使用带有构造函数的类作为类型参数
- 受约束的成员函数和显式模板实例化
- 对显式实例化的模板函数的未定义引用
- 虚幻引擎:实例化静态网格体在实例化时不旋转