笔记来自课程,https://www.udemy.com/course/unreal-engine-5-cpp-multiplayer-shooter
1. Animation Bluprint
AnimationBluprint可继承自AnimInstence, AnimInstance中包含Character,创建动画实例。同时AnimInstence中需要选择相应的skeleton.
2. Seamless Travel and Lobby
两种level travel
GameMode中使用bUseSeamlessTravel设置Semeless Travel
project setting中可设置transition level.
3. Network Role
UserWidget类中含有level转换时需要的事件。
三种Role
其中特别的是,sever所控制的remote role为autonomouse proxy,其他为simulated proxy.
if(HasAuthority())是对getloccal简写。
Replicate三要素
Pickup Widget
widget component for weapon
pickup widget 在构造的时候就产生,之后在oncomponentbeginoverlay里可设置visibility.
FORCEINLINE 强制为inline函数。
COND_OwnerOnly 和 COND_AutonomousProxy
OnRep不在server调用。
用IsLocallyControlled() 而不用Role == AutonomousProxy
用HasAuthority()而不是直接判断是否为server
以上两个没有必然联系。特别是在不确定是否为listen模式下。
Equipping Weapon
创建新component先把bCanEverTick关掉,如果暂时不需要tick的话。
创建并设置一个ActorComponent为replicated
mesh附上武器
1. Initialize Socket 2. HandSock->AttachActor
在构造函数之后,但是调用的又足够早。
Crouch
ACharacter::Crouch(bool bClientSimulation)
命令行 show collision 可在游戏测试中显示碰撞信息
Pitch in Multiplayer
GetPackAngles在网络传输中压缩了角度,使用时需要解压缩。
FABRIK IK for Hand Palcement
获取transform然后转通过character的mesh转到bone space, 中间提供一个reference(hand_r).
FTransform中的rotation,先转FQuat再传参。
设置FABRIK,State Machine
effector target 参考骨骼
effector transform space 使用bone sapce
tip bone 要移动的骨骼
root bone 骨骼移动的停止相关