iShellz Posted March 14, 2014 Share Posted March 14, 2014 How do i set a sprite to ignore the gravity. and Make sprite fall out of world bounds. Thank You Link to comment Share on other sites More sharing options...
valueerror Posted March 14, 2014 Share Posted March 14, 2014 ad 2) you could trysprite.body.collideWorldBounds=false;ad 1) sprite.body.static =true;but it doesnt ignore gravity then -- it is static (immovable) Link to comment Share on other sites More sharing options...
rich Posted March 14, 2014 Share Posted March 14, 2014 Set the gravityScale value to 0, then it will ignore gravity. It won't "fall" out of bounds though, as there's no gravity Bengalaa 1 Link to comment Share on other sites More sharing options...
valueerror Posted March 14, 2014 Share Posted March 14, 2014 afaik gravityScale is not available for p2 physics ??! and for some reason body.static=true; or body.mass=0; resets sprite positions to 0,0 now.. Link to comment Share on other sites More sharing options...
BunBunBun Posted March 14, 2014 Share Posted March 14, 2014 valueerror, I wrote about it in my topic , but haven't received the reply. Link to comment Share on other sites More sharing options...
iShellz Posted March 14, 2014 Author Share Posted March 14, 2014 So gravityScale does not work in P2 physics Also how to check for overlap and no collision in P2 would be awesome Link to comment Share on other sites More sharing options...
valueerror Posted March 14, 2014 Share Posted March 14, 2014 to me it seems like p2 has big advantages in terms of physics simulation but lacks a LOT of useful functionality you have in arcade physics.. but if you want materials and springs you have to go with p2.. i really hope that all the arcade stuff will eventually make it's way to p2.. like.. body.touching.right customCollisionProcessHandler, gravityScale, and much much more.. Link to comment Share on other sites More sharing options...
iShellz Posted March 14, 2014 Author Share Posted March 14, 2014 to me it seems like p2 has big advantages in terms of physics simulation but lacks a LOT of useful functionality you have in arcade physics.. but if you want materials and springs you have to go with p2.. i really hope that all the arcade stuff will eventually make it's way to p2.. like.. body.touching.right customCollisionProcessHandler, gravityScale, and much much more.. I would be all set with arcade physics if they had polygon support Link to comment Share on other sites More sharing options...
rich Posted March 14, 2014 Share Posted March 14, 2014 gravityScale works fine, have uploaded an example of how to use it. One for Materials too. Arcade will never have polygons (again), that is what P2 is for. kctang 1 Link to comment Share on other sites More sharing options...
valueerror Posted March 14, 2014 Share Posted March 14, 2014 thx rich.. looking into it.. could you tell us something about the body static behaviour too? Link to comment Share on other sites More sharing options...
iShellz Posted March 14, 2014 Author Share Posted March 14, 2014 gravityScale works fine, have uploaded an example of how to use it. One for Materials too. Arcade will never have polygons (again), that is what P2 is for. Got it now, i see the example. Thanks bunches rich edit, that did it thanks rich Link to comment Share on other sites More sharing options...
BunBunBun Posted March 15, 2014 Share Posted March 15, 2014 valueerror, can try use: sprite.data.motionState = 2; https://github.com/photonstorm/phaser/issues/563 Link to comment Share on other sites More sharing options...
valueerror Posted March 15, 2014 Share Posted March 15, 2014 thanks ! and for gravity scale you have to say sprite.body.data.gravityScale - no wonder i thought it didn't work.. Link to comment Share on other sites More sharing options...
cucumber Posted March 15, 2014 Share Posted March 15, 2014 Waiting for body.static fix.. And some other issues: 1) How to use applyForce?when i try something like this:sprite.body.applyForce(100,500,500);sprite is just disappears without error messages. 2) Is it possible to drag p2 bodies with a pointer?3) And examples with "constraint" dont workhttp://examples.phaser.io/_site/view_full.html?d=p2%20physics&f=distance+constraint.js&t=distance%20constraintCant wait for everything work perfectly. Phaser is best. Link to comment Share on other sites More sharing options...
cucumber Posted March 15, 2014 Share Posted March 15, 2014 Found a way to use applyForce body.data.applyForce([1,1],[500,500]);but i dont understand what it is for I'm trying to make radial gravity to a point Link to comment Share on other sites More sharing options...
Athul Dilip Posted September 14, 2014 Share Posted September 14, 2014 If you're getting strange errors when using body.static = true. Its because you're using the old version of phaser! I got that same error so I replaced phaser.js with the new version of it and it worked Link to comment Share on other sites More sharing options...
Recommended Posts