Git Product home page Git Product logo

Comments (4)

Exopandora avatar Exopandora commented on July 30, 2024

Thanks for reporting. While working on some major refactorings lately (see 7128310), I also came across this issue. I wanted to correctly set the camera rotations after a teleport command. Unfortunately, this the problem is a bit more nuanced, as ClientPacketListener.handleMovePlayer is invoked in the following scenarios:

  • Teleport/Ender pearl
  • Dimension change
  • Mount/Dismount

When in Shoulder Surfing perspective, the camera rotations should not reset when teleporting (or using an ender pearl) or (dis-)mounting, as it can be very disorienting. It is also not always possible to distinguish those cases.

As a possible fix, you could use the new Shoulder Surfing API and set the camera rotations manually, if thats possible in your case:

ShoulderSurfing.getInstance().getCamera().setXRot(xRot);
ShoulderSurfing.getInstance().getCamera().setYRot(yRot);

Note that this API has not been released yet. It will be available for Shoulder Surfing 4.0.0+. For now, you would need to access the implemention directly:

ShoulderRenderer.getInstance().setCameraXRot(xRot);
ShoulderRenderer.getInstance().setCameraYRot(yRot);

from shouldersurfing.

ZsoltMolnarrr avatar ZsoltMolnarrr commented on July 30, 2024

Thank you for the feedback.

As far as I can see after some investigation, I don't think using the API would feasible in my case. I sent a vanilla packet (by invoking vanilla teleport function) handled by vanilla client code.
Sending a custom packet would be possible to adjust the camera angle additionally, however the position and custom angle adjusting packets would not be fully synchronized, likely resulting multiple camera adjustments under a short time.

I understand your concerns your regarding disorienting camera adjustments, and absolutely commend that 🫡, still I think it would be most optimal if Shoulder Surfing would handle the rotation inside the packet.
So I have the following recommendations:

  1. If rotation data in the packet is only present at teleport cases (not at dismounting), adjusting the camera unconditionally will not cause districation (imo), since the position of the camera is changed by the teleport any way.
  2. If rotation is always passed by the server (so we cannot ever distinguish), how about adjusting camera rotation if the difference between current and received angles is larger than a certain (configurable) value (for example 20 degrees).

What do you think?

from shouldersurfing.

Exopandora avatar Exopandora commented on July 30, 2024

I implemented it now by checking for rotation changes. I also did this in initial experiments last week, but there I injected into some other teleport function which caused many issues. The only caveat now is that it also resets the camera rotations when changing dimensions, but I'm fine with that. Let me know if it works for your use case!

from shouldersurfing.

ZsoltMolnarrr avatar ZsoltMolnarrr commented on July 30, 2024

Hello!
I tested the topmost commit of 1.20.1 branch. The few scenarios I was able to test it worked perfectly, including shadow step. :)

caveat now is that it also resets the camera rotations when changing

I believe instead of a caveat this is actually the correct behavior.

Thank you for the cooperation!

from shouldersurfing.

Related Issues (20)

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    🖖 Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo D3

    Bring data to life with SVG, Canvas and HTML. 📊📈🎉

Recommend Topics

  • javascript

    JavaScript (JS) is a lightweight interpreted programming language with first-class functions.

  • web

    Some thing interesting about web. New door for the world.

  • server

    A server is a program made to process requests and deliver data to clients.

  • Machine learning

    Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google ❤️ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.