UE5.1 代码编译错误:FRotator 初始化方法
在UE5.1中,代码 'const FRotator ActorRotation = Controller->GetControlRotation(); FRotator YawRotaion = (0.f, ActorRotation.Yaw,0.f);' 这段代码有语法错误,正确写法如下:
'const FRotator ActorRotation = Controller->GetControlRotation(); FRotator YawRotaion(0.f, ActorRotation.Yaw, 0.f); // 使用构造函数进行初始化'
注意:在创建FRotator对象时,可以使用构造函数进行初始化,也可以使用赋值语句进行初始化,但是需要使用花括号括起来。例如:
'FRotator YawRotaion = { 0.f, ActorRotation.Yaw, 0.f }; // 使用赋值语句进行初始化,需要使用花括号括起来'
原文地址: http://www.cveoy.top/t/topic/mzEq 著作权归作者所有。请勿转载和采集!