yurqo Posted July 25, 2020 Share Posted July 25, 2020 I'm new to Matter.js, trying to make air hokey game and don't understand how to use Matter's MouseConstraint with pixi. It works fine if your canvas element and physics world are the same size (https://codepen.io/celsowhite/pen/XWbEzpx), but what if not and you have some PIXI.Container instead? I need player to be able to move the striker while having impact on the puck, which depends on striker's inertia, that's why just changing the position of body in Matter world won't work. While it's probably not hard to take care of creating and destroying Constraints in Matter world according to local coords in mouse input events, maybe there's more simple and natural way of making them work together? Quote Link to comment Share on other sites More sharing options...
Jammy Posted July 25, 2020 Share Posted July 25, 2020 7 hours ago, yurqo said: I'm new to Matter.js, trying to make air hokey game and don't understand how to use Matter's MouseConstraint with pixi. It works fine if your canvas element and physics world are the same size (https://codepen.io/celsowhite/pen/XWbEzpx), but what if not and you have some PIXI.Container instead? I need player to be able to move the striker while having impact on the puck, which depends on striker's inertia, that's why just changing the position of body in Matter world won't work. While it's probably not hard to take care of creating and destroying Constraints in Matter world according to local coords in mouse input events, maybe there's more simple and natural way of making them work together? I would recommend not using mousecontraints etc from matter, just the matter physics, if you want your game to have physics, add them to matterjs as required (as bodies or whatever) and calculate the constraints yourself. Quote Link to comment Share on other sites More sharing options...
Recommended Posts
Join the conversation
You can post now and register later. If you have an account, sign in now to post with your account.
Note: Your post will require moderator approval before it will be visible.