Epic Fight

Epic Fight

13M Downloads

[Compability Help]: Way to get head position and rotation each frame of an animation

1ost opened this issue ยท 1 comments

commented

Have you checked if there's any similar suggestions ?

  • I checked, there are no similar suggestions that have been reported.

Are you using the latest Epic Fight ?

  • I checked I'm using latest Epic Fight version.

Is this suggestion related to another mod? (i.e: add animations for X mod)

  • This is related to other mods.

The mod

Self-made mod

Minecraft Version

1.20.1

What's your suggestion?

Hello, i am currently in the middle of making my mod work with Epic Fights mod and i am wondering if there's any way to get the position and rotation of the head each frame.

I want a way to get access to this information so that i can make some head accessories (rendered in separate layers) follow the player's head position and rotation while its being modified by the combat mode animations.

Also sorry if this is not where i am supposed to post this.

Thank you in advance

commented

When you can access LivingEntityPatch, you can try this to get the animated transform of a specific joint

In LivingEntityPatch.class:

Pose pose = this.animator.getPose(partialTicks);
OpenMatrix4f animationTransform = this.armature.getBindedTransformFor(pose, this.armature.searchJointByName("Head"));

Since you're using a layer to render your items, I recommend using PatchedLayer by calling the PatchedRenderersEvent.Modify event. It works exactly the same way how vanilla renderers handle the layers but with more parameters that you may need to render based on the animated model.

In PatchedLayer.class:

protected abstract void renderLayer(T entitypatch, E entityliving, @Nullable R vanillaLayer, PoseStack poseStack, MultiBufferSource buffer, int packedLight, OpenMatrix4f[] poses, float bob, float yRot, float xRot, float partialTicks);

Sorry for the late reply tho, If you have further questions please leave a message here