How do you make character move relative to position on moving actor

人在火车上,火车在移动中。怎么实现人从车头走到车尾的功能。

我目前是这么实现的,继承CharacterMovementComponent 和 PathFollowingComponent,把PathFollowingComponent中的MovementComp->GetActorFeetLocation() 改成 MovementComp->UpdatedComponent->RelativeLocation,然后重载CharacterMovementComponent的MoveAlongFloor函数 通过 LineTraceSingleByChannel 获取位置。但是这么实现的问题在于AIcontroller的PathFollowingComponent是private_subobject,可能会有问题。所以有别的实现方法吗

撇开具体的实现方式,一般这种需求讨巧的做法都是火车实际不动,人在上面走,火车外部的场景动,配合 Camera Shake 之类的效果。

哦,原来是这样子。这块具体代码并不熟悉,看看是否有其他人了解来回答这个问题~

我只是举个在火车上移动的例子,实际上我们是一个航海类的游戏,人需要在船上走,船需要在海上航行,很多的船。所以这种做法应该不能满足需求。还有别的什么办法吗?

哦,行。还是要谢谢你了~