Git Product home page Git Product logo

Comments (3)

galacticwarrior9 avatar galacticwarrior9 commented on July 17, 2024

I think I managed to get a working version, but it required making a fork of Movecraft-Cannons and Movecraft itself with a few changes

One problem with cannon rotation was that the CraftRotateEvent could be cancelled by other plugins with listeners operating at a higher priority. As a result, Movecraft-Cannons would rotate the cannons data even though the craft itself was ultimately prevented from rotating. To resolve this, the CraftRotateEvent listener was set to run at EventPriority.MONITOR with ignoreCancelled set to true.

With translation, I think the problems stemmed from the use of CraftPreTranslateEvent:

  • The craft may be prevented from moving if CraftTranslateEvent is cancelled, which is fired after CraftPreTranslateEvent. As a result, the data of the cannons is translated while the craft itself is not.
  • It looks like the displacement of the craft may be modified after CraftPreTranslateEvent is called (e.g. the y displacement for gravity-enabled craft here, if I'm understanding this correctly), so there could be a discrepancy between how much Movecraft-Cannons translates the cannons data by and how much the craft translates in reality. To resolve this, I added a new CraftPostTranslateEvent event to Movecraft, which is identical to CraftPreTranslateEvent but is only fired after translation has occurred.

Another change I made was caching the cannons of each craft after detection, rather than trying to find them at the translation stage. I don't know if that particularly helped, but it was a nice performance booster

from movecraft-cannons.

TylerS1066 avatar TylerS1066 commented on July 17, 2024

One problem with cannon rotation was that the CraftRotateEvent could be cancelled by other plugins with listeners operating at a higher priority. As a result, Movecraft-Cannons would rotate the cannons data even though the craft itself was ultimately prevented from rotating. To resolve this, the CraftRotateEvent listener was set to run at EventPriority.MONITOR with ignoreCancelled set to true.

This is a good point, thank you for letting me know.

With translation, I think the problems stemmed from the use of CraftPreTranslateEvent

Hmm, that is a good point. I'm going to ask CC if there is a proper method to do this in the current API, or if we need to expand the API as you suggest.

from movecraft-cannons.

TylerS1066 avatar TylerS1066 commented on July 17, 2024

Since there have been no reports of problems in 3 months, I am going to mark this as resolved!

from movecraft-cannons.

Related Issues (19)

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.