I have a trident as an item display entity.
I want it to always be turned to me in the same position.
How can I do this? I managed to do it a bit with a custom offset, but when I look at the other side of the world, its rotation changes completely.
I want it to always be turned to me in the same position.
How can I do this? I managed to do it a bit with a custom offset, but when I look at the other side of the world, its rotation changes completely.
Java:
float playerYaw = player.getLocation().getYaw();
float playerPitch = player.getLocation().getPitch();
float customYawOffset = (float) customConfig.getDouble("trident.customYawOffset");
float customPitchOffset = (float) customConfig.getDouble("trident.customPitchOffset");
playerYaw = (float) Math.toRadians(-playerYaw + customYawOffset);
playerPitch = (float) Math.toRadians(-playerPitch + customPitchOffset);
itemDisplay.setTransformation(
new Transformation(
new Vector3f(),
new AxisAngle4f(playerPitch, 1, 0, 0),
new Vector3f(1, 1, 1),
new AxisAngle4f(playerYaw, 0, 1, 0)
)
);
- Version Output
- 1.20.6