Giter Club home page Giter Club logo

Comments (2)

badlogic avatar badlogic commented on May 27, 2024 1

You're not using it incorrectly. This appears to be a bug triggered by adding a physics component. I'm not super familiar with that Phaser sub-system, so I'm not sure what's going wrong. I'll update the issue once I've figured it out.

from spine-runtimes.

davidetan avatar davidetan commented on May 27, 2024

In Phaser, if you use arcade physics and set the scaleX to a negative number will result in having the physics body reflected regardless on the usage of a SpineGameObject or a normal GameObject.

It's possible to get the very same result of the video on this phaser playground example adding block.scaleX = -block.scaleX; as latest line of the create function. The debug bounding box is reflected on the right of the brown box:
image

We have to consider that to flip a GameObject in Phaser, it seems that there are flip methods. In this case the setFlipX(boolean) should be used.
It's important to notice this part of the Phaser flip documentation:

If this Game Object has a physics body, it will not change the body. This is a rendering toggle only.

So in general it's the user that has to take care of the GameObject body position for some operation (such as rotation) on the GameObject - at least for arcade physics.

However, when using setFlipX(boolean) on a SpineGameObject, it is not flipped. We should do that probably and will make a fix to it.

In any case, my advice is to explore also the matter physics system. That is definitely more advanced and your use case would work out of the box.
Indeed, scaling with negative numbers in matter won't produce the effect of reflecting the GameObject body.

from spine-runtimes.

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.