你好!我在使用虚幻5中使用spine时,想要读取boundingbox作为角色的攻击判定的边界。我现在可以通过蓝图来实现这个操作么?

Related Discussions
...

Mario

哦这真是个不幸的消息。不能通过蓝图读取的话,是否有方法可以通过C++读取呢?

是的! 这是自定义 Pawn 的 C++ 代码,向您展示了如何获取 USpineSkeletonAnimationComponent。 从该组件中,您可以获得 spine::Skeleton 和其他核心 API 对象。
https://github.com/EsotericSoftware/spine-runtimes/blob/4.1/spine-ue4/Source/SpineUE4/SpineboyCppPawn.cpp

然后,您可以创建一个 spine::SkeletonBounds 对象,该对象可用于检查点和线与骨架边界框附件的交点。 这是执行此操作的代码(使用 SFML 作为引擎):
https://github.com/EsotericSoftware/spine-runtimes/blob/4.1/spine-sfml/cpp/example/main.cpp#L147

Yes! Here's C++ code for a custom Pawn, that shows you how to fetch the USpineSkeletonAnimationComponent. From that component, you can get the spine::Skeleton and other core API objects.
https://github.com/EsotericSoftware/spine-runtimes/blob/4.1/spine-ue4/Source/SpineUE4/SpineboyCppPawn.cpp

You can then create a spine::SkeletonBounds object, which can be used to check for intersections of points and lines with bounding box attachments of the skeleton. Here's code that does that (using SFML as the engine):
https://github.com/EsotericSoftware/spine-runtimes/blob/4.1/spine-sfml/cpp/example/main.cpp#L147

  • Kaz replied to this.
  • Kaz likes this.

    Mario
    谢谢你的回复:)。我想我需要一些时间去理解这些内容。