Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Rotate the player's body #59

Open
luisBazanDev opened this issue Nov 5, 2023 · 3 comments
Open

Rotate the player's body #59

luisBazanDev opened this issue Nov 5, 2023 · 3 comments

Comments

@luisBazanDev
Copy link

I was trying to make some kind of selector and I need the npc I have to rotate completely, but with the lookat method it only rotates the player's head and not the entire body.

Perhaps something similar can be achieved with the BodyRotationControl class. and make a lookat method that receives a boolean value to rotate the body as well, I couldn't implement it correctly but maybe someone else will do it

https://github.com/FancyMcPlugins/FancyNpcs/blob/main/implementation_1_20_2/src/main/java/de/oliver/fancynpcs/v1_20_2/Npc_1_20_2.java#L141

I only found this reference to the mentioned class:
https://nekoyue.github.io/ForgeJavaDocs-NG/javadoc/1.18.2/net/minecraft/world/entity/ai/control/BodyRotationControl.html

@OliverSchlueter
Copy link
Member

OliverSchlueter commented Feb 16, 2024

Should be fixed now, would be greate, if you could test it.

Latest dev build: https://fancyplugins.de/FancyNpcs/download/

@luisBazanDev
Copy link
Author

Ok. I will test it later, don't worry.

@luisBazanDev
Copy link
Author

I did 2 tests. Which are the same ones I tried before. In the first test it was a little better but since the package is used it makes the npc hit the air so it looks bad. In the second test the same thing happens as before. The body begins to rotate when the angle of rotation of the head reaches the limit so to speak. Well, I'm not sure if it's possible to implement the class I mentioned "BodyRotationControl". I attach a video with both tests and their codes.

Test 1:

Location location = npc.getData().getLocation();
location.setYaw(angle - 180);
location.setPitch(0);

npc.getData().setLocation(location);
npc.move(player);

Test 2:

Location location = npc.getData().getLocation();
location.setYaw(angle - 180);
location.setPitch(0);

npc.lookAt(player, location);
0216.1.mp4

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Projects
None yet
Development

No branches or pull requests

2 participants