PhasedEvolution Posted October 6, 2016 Share Posted October 6, 2016 Hello. I was wondering what Phaser Phyisics would be more appropriate to simulate that kind of "wobble" effect of a jelly body. Like in a 2d circle that when hit with something kind of absorbs the impact... Do you know a good way to simulate this kind of phyisics body? Link to comment Share on other sites More sharing options...
tips4design Posted October 6, 2016 Share Posted October 6, 2016 So, you want something like a soft body? Something like this: http://brm.io/matter-js/demo/#softBody ? PhasedEvolution 1 Link to comment Share on other sites More sharing options...
PhasedEvolution Posted October 6, 2016 Author Share Posted October 6, 2016 Wow. yeah, something similar to that. I am kind of a newbie so sorry if it is a stupid question... How can I include those type of Phyisics in Phaser? Link to comment Share on other sites More sharing options...
Tom Atom Posted October 7, 2016 Share Posted October 7, 2016 Hi, if the effect is not part of gameplay, but visual effect only, then do not use physics for it and do it with tweens. Look at this game: http://sbc.littlecolor.com/goblinrun/ - it has play button on menu screen, that wobbles every two seconds. Do you need something like this? Link to comment Share on other sites More sharing options...
PhasedEvolution Posted October 7, 2016 Author Share Posted October 7, 2016 3 hours ago, Tom Atom said: Hi, if the effect is not part of gameplay, but visual effect only, then do not use physics for it and do it with tweens. Look at this game: http://sbc.littlecolor.com/goblinrun/ - it has play button on menu screen, that wobbles every two seconds. Do you need something like this? I am not sure. I want the body of (in this case) a circular sprite to be shaped according to the wobble. The phyisics body would be resized when the wobble happened... Would that happen? Link to comment Share on other sites More sharing options...
lumoludo Posted October 7, 2016 Share Posted October 7, 2016 I haven't used any of the physics in Phaser, but I have done some game physics in the past. If you want to build a physics game that uses soft bodies like the one that tips4design linked to, it looks like you will need to use the P2 physics in Phaser. Each of those circles in that demo are circle rigid bodies, and each of the lines that connect them are springs. Once you have created all the bodies and connected them with springs, you can try changing the springs' stiffness and damping properties to change how stiff or squishy they are. PhasedEvolution 1 Link to comment Share on other sites More sharing options...
PhasedEvolution Posted October 7, 2016 Author Share Posted October 7, 2016 13 minutes ago, lumoludo said: I haven't used any of the physics in Phaser, but I have done some game physics in the past. If you want to build a physics game that uses soft bodies like the one that tips4design linked to, it looks like you will need to use the P2 physics in Phaser. Each of those circles in that demo are circle rigid bodies, and each of the lines that connect them are springs. Once you have created all the bodies and connected them with springs, you can try changing the springs' stiffness and damping properties to change how stiff or squishy they are. Is it something like this? http://www.emanueleferonato.com/2012/09/21/step-by-step-creation-of-a-box2d-soft-body-blob/ Link to comment Share on other sites More sharing options...
lumoludo Posted October 7, 2016 Share Posted October 7, 2016 4 minutes ago, PhasedEvolution said: Is it something like this? http://www.emanueleferonato.com/2012/09/21/step-by-step-creation-of-a-box2d-soft-body-blob/ Yes, that's pretty much it! You can see that the soft body is build a little differently in Emanuele's tutorial: there is a lot more space than in that Matter.js demo. But, they should both give you squishy things. The important thing is the usage of springs to connect several rigid bodies. In that tutorial they are called joints, but a joint that has the ability to compress or stretch like that can also be called a spring. Link to comment Share on other sites More sharing options...
PhasedEvolution Posted October 7, 2016 Author Share Posted October 7, 2016 Well I will look into that then I had no idea these things could be made this way. I find it amazing for real... Thank you once again @lumoludo! lumoludo 1 Link to comment Share on other sites More sharing options...
PhasedEvolution Posted October 8, 2016 Author Share Posted October 8, 2016 @lumoludo Hey. I was just wondering if it is possible to implement Matter.js in a phaser game? Link to comment Share on other sites More sharing options...
mattstyles Posted October 8, 2016 Share Posted October 8, 2016 Matter.js is agnostic of the rendering engine you attach to it so it should be possible, however, does it have features you don't have with P2? If your answer to that is no then just use the P2 instance that is already integrated with phaser and save yourself some complexity. Unless you want to fiddle with that complexity of course. PhasedEvolution and lumoludo 2 Link to comment Share on other sites More sharing options...
PhasedEvolution Posted October 8, 2016 Author Share Posted October 8, 2016 41 minutes ago, mattstyles said: Matter.js is agnostic of the rendering engine you attach to it so it should be possible, however, does it have features you don't have with P2? If your answer to that is no then just use the P2 instance that is already integrated with phaser and save yourself some complexity. Unless you want to fiddle with that complexity of course. I am not really sure... I would like to implement soft bodies, that kind of jelly effect. I was told it could be done with something similar to this http://www.emanueleferonato.com/2012/09/21/step-by-step-creation-of-a-box2d-soft-body-blob/ ... I didn't find any specific phaser tutorial for that... What do you think? Link to comment Share on other sites More sharing options...
Recommended Posts