简体   繁体   English

Rotation和getComponentRotation有什么区别?

[英]What is the difference between Rotation and getComponentRotation?

In the UE4 game engine What is the difference between Rotation and GetComponentRotation? 在UE4游戏引擎中,Rotation和GetComponentRotation有什么区别?

Try to understand this by documentation on at 尝试通过以下位置的文档来了解这一点

https://api.unrealengine.com/INT/API/Runtime/Core/Math/FVector/Rotation/index.html https://api.unrealengine.com/INT/API/Runtime/Core/Math/FVector/Rotation/index.html

But I could not? 但是我不能吗?

I need some details and explanation about this .. 我需要一些细节和解释。

These two methods are from different objects: 这两种方法来自不同的对象:

FVector::Rotation FVector ::旋转
USceneComponent::GetComponentRotation USceneComponent :: GetComponentRotation

Both return a rotation object ( FRotator ) that encodes the rotation in the Yaw/Pitch/Roll representation. 两者都返回一个旋转对象( FRotator ),该对象以Yaw / Pitch / Roll表示形式对旋转进行编码。

The difference is that the Rotation returns an FRotator object that, if applied to a component, will make the component "look" in the direction of the vector. 区别在于Rotation返回一个FRotator对象,该对象如果应用于组件,将使该组件在向量方向上“看起来”。 For example, if you take the difference between the position of a sphere and the position of a player, use Rotation, and then apply the rotation to the player, the player will face the sphere. 例如,如果您将球体的位置与播放器的位置之间的差值计算在内,请使用“旋转”,然后将旋转应用于播放器,播放器将面对球体。

GetComponentRotation returns the current orientation of the component in global space. GetComponentRotation返回组件在全局空间中的当前方向。

声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM