Search the Community
Showing results for tags 'local point'.
Found 1 result
Hi all, long time lurker, love the framework! The fact that I've done two weeks of coding without having to ask a question really shows the quality of Phaser, the docs, and the wealth of information on the forums! Unfortunately, I couldn't find an answer to this. I'm trying to get a local point on a P2JS body converted to world co-ordinates. To put it into context: I want another sprite to move to a specific point on a physics body. Funny enough, there are parameters in the physics.p2.createSpring() that allow you to specify local points on the bodies to attach the spring to. Similar parameters are found in the P2JS constraint cosntructors. However, looking at the source code taught me nothing because it's just a reference to the P2JS spring creator. I looked in the P2JS docs to find a LinearSpring.getWorldAnchorA() function, but calling it as spring.data.getWorldAnchorA() results in the following error: Uncaught TypeError: Cannot set property '0' of undefined Phaser.js:79022 I suppose I could put the body in a group along with an invisible sprite to mark the local point and get sprite.world, but that feels so hacky. I'd create an empty group to mark the point, but groups don't have a world attribute. I could found no function in the Phaser docs to convert a local point to a world point, which seems such a simple and common thing to do. Am I missing something?