- Java 双重比较
- java - 比较器与 Apache BeanComparator
- Objective-C 完成 block 导致额外的方法调用?
- database - RESTful URI 是否应该公开数据库主键?
我是 UE4 的新手,正在尝试了解有关控制角色 pawn 的一些基本概念。我正在摸索着尝试实现一些角色移动逻辑。我打算使用基本的 WASD 来向前、向后、左右移动角色——就像几乎每个基本的第一人称射击游戏一样。我还希望通过鼠标输入来旋转角色。
我有自己的自定义 PlayerController
和 Character
类。
添加代码来移动角色 - 前面、后面、侧面 - 似乎都在角色类本身中。那里有一个名为 AddMovementInput 的方法,它似乎可以为我修改位置。这也让我认为角色类“拥有”自己的位置。这是有道理的,因为一次可能有多个字符类,每个字符类位于不同的位置,对吧?
添加旋转角色的代码有类似的控制旋转的方法- AddControllerYawInput
, AddControllerPitchInput
, AddControllerRollInput
。只需查看函数的名称,就会发现偏航俯仰和横滚由玩家 Controller “拥有”。查看函数的文档和评论进一步支持了这一点:“将输入(影响偏航)添加到 Controller 的 ControlRotation,如果它是本地 PlayerController。”所以在我看来, yaw pitch 和 roll 是玩家 Controller “拥有”的值,对吧?
作为初学者,这让我感到困惑:我对位置存储在角色本身但旋转似乎没有这一事实感到困惑。
我有兴趣了解应该如何“思考”角色或兵的移动。我只是不清楚,这让我在这个话题上挂断了。
最佳答案
此设计背后的意图是将控制机制与角色物理分开。在写软件方面,的思路是decouple 玩家控制游戏世界物理中角色旋转的游戏互动机制的旋转。例如,我可以瞄准向上,而我角色的 body 以某种方式倾斜向下——因此可能会与位于其下方的物体发生物理碰撞.
看,您对“谁拥有什么”的看法是正确的。 You can see AController
,PlayerController
的基类,有一个类型为 FRotator
的成员变量 ControlRotation
>。该数据成员的文档说:
ControlRotation (accessed via GetControlRotation() ), determines theviewing/aiming direction of the controlled Pawn ...
和GetControlRotation()
further clarifies :
This is the full aim rotation, which [...] may differ fromthe rotation of the controlled Pawn (which may choose not to visuallypitch or roll, for example).
与此类似, Controller 旋转与角色自行管理的任何“旋转相关”保持分离。
这在文档中得到了进一步的支持,例如参见Pawn
(ACharacter
的基类):
Pawn is the base class of all actors that can be possessed by playersor AI. They are the physical representations of players and creaturesin a level.
在AController
下:
Controllers are non-physical actors that can possess a Pawn to controlits actions.
关于c++ - 为什么 PlayerController "own"是偏航俯仰和滚动,而 Character "owns"是它的位置?,我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/52013550/
我必须在 Android 中从陀螺仪的智能手机输出中计算偏航、滚转、俯仰,我编写了以下代码: if(event.sensor.getType()==Sensor.TYPE_GYROSCOPE){
四元数有利于它们之间的内插旋转。到目前为止,一切都很好。 如果我有一个网络游戏,将旋转量转换为vector3f就足够了还是应该使用四元数? 为了使游戏更流畅,我可能必须在上次发送的旋转和当前旋转之间进
我正在使用Reach RS +设备来捕获GPS位置数据以及IMU数据(侧倾,俯仰和偏航);请参阅制造商website上的“ Point Collection”图像。 我正在尝试确定底点的GPS坐标(接
如果可能的话,我想知道如何获得确定 Android 设备位置的航向、俯仰和滚动角度。不要考虑设备相关的细节。引用有用的文档也很有值(value)。谢谢! 最佳答案 我手头没有精确的解决方案,但全口径解
我在 WorldWind 中有一个 3D 飞机模型,这是一个在 OpenGL Java 上运行的 3D 地球模型。我使用数据库中的数据(包括纬度、经度和替代度)更新此模型的位置。如何从当前位置获取航向
我想在没有红外感应条的情况下使用 wiimote 来控制光标。我为此使用了俯仰和滚动值。问题是俯仰接近0度的时候,横滚很不稳定,而俯仰接近90度的时候,本身就很不稳定,但是横滚还好。我非常频繁地轮询
我正在为我的学校做一个编程主题的项目。我在 Swift 的 Xcode 中工作。我想制作一个使用陀螺仪的应用程序。我不知道,但由于 Xcode 中的一些我不知道如何修复的错误,它不会在我的 iPhon
我正在尝试使用 Vision 框架获取图像中人脸的俯仰/偏航/滚动,但始终为所有值获取 0。图像应该很容易处理(主要是前瞻性肖像)。 我通过对它们使用 Amazon Rekognition 成功获得了
我有一个基于提供的纬度/经度坐标、缩放、偏航和俯仰的谷歌地图和街景。我需要调用一个 javascript 来为每个值更新一个隐藏字段,每当任何细节从它们的默认值发生变化或当一个按钮被点击时。 因此,无
我的观众没有收到来自被跟随球员的任何投球轮换。 我正尝试与 ShooterGame 项目合作,对 FPS 旁观者功能进行概念验证。我在 GameMode 中添加了将 VictimPlayer 切换到旁
我正在尝试使用陀螺仪制作一个简单的应用程序,其中角色会根据 iPad 1 的旋转进行移动。 我的代码无法正常工作,因此我测试了原始、俯仰、偏航的值,无论我如何移动设备,它们实际上都保持为零。我确定 i
用于从 cvPOSIT 生成的 3*3 旋转矩阵计算偏航(z 轴)、横滚(x 轴)和俯仰(y 轴)的算法是什么。 最佳答案 使用cv::RQDecomp3x3() .“它可选择返回三个旋转矩阵,每个轴
我已经研究了一段时间,现在我必须决定走哪条路。 矿山要求:需要知道设备相对于真实航向(地理北极,而非磁极)的方向。为此,我必须使用指南针,现在我必须决定其他的东西,加速度计或陀螺仪。 因为这对我来说是
我的问题 我想用 3x3 旋转矩阵旋转一个 mayavi.mlab.imshow 对象。我能找到的唯一旋转此对象的方法是将对象的 actor.orientation 设置为 [pitch, roll,
我是一名优秀的程序员,十分优秀!