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

Matter.Body.applyForce function doesn't work in React-Native !! #1297

Open
burakkbilginn opened this issue Jun 1, 2024 · 0 comments
Open

Comments

@burakkbilginn
Copy link

I am trying to make a coin, change its gravity due to some events. I tried setStatic(coin, true) method, but it doesn't react on events. Also, I tried applyForce(coin, coin.position, { x: 10, y:100 }) but again no reaction. Should I do something more here? How can I make it work?

my entity is:

let coin = Matter.Bodies.rectangle(Constants.MAX_WIDTH / 2, 25, 40, 40 )
        coin.collisionFilter = {
            'group': -1,
            'category': 2,
            'mask': 0,
        }
        coin.ignoreGravity = true
        // Matter.Body.setMass(coin, 0.001 * (coin.width * coin.height))
        Matter.Body.setStatic(coin, false)
        Matter.Body.applyForce(coin, coin.position, {
            x: 10,
            y:100
        });
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

1 participant