zelcard Posted August 4, 2016 Share Posted August 4, 2016 Greetings, is it possible for two immovable objects (object1.body.immovable = true; object2.body.immovable = true;) to collide? If yes how that can be achieved? Thanks! Link to comment Share on other sites More sharing options...
symof Posted August 4, 2016 Share Posted August 4, 2016 47 minutes ago, zelcard said: Greetings, is it possible for two immovable objects (object1.body.immovable = true; object2.body.immovable = true;) to collide? If yes how that can be achieved? Thanks! The short answer is no. WHY? Because they are both immovable so they should never collide. Link to comment Share on other sites More sharing options...
Ralph Posted August 5, 2016 Share Posted August 5, 2016 Ya this doesn't make any sense lol. Only one of the sprites should be immovable (aka the one that isnt moving). Both sprites dont need to have body.immovable set to true in order for them to collide. Link to comment Share on other sites More sharing options...
drhayes Posted August 5, 2016 Share Posted August 5, 2016 What are you trying to do in your game? Link to comment Share on other sites More sharing options...
Iszard Posted August 5, 2016 Share Posted August 5, 2016 I'm running into the same problem with static / kinematic bodies. Personally I want near pixel perfect collision detection without transferring velocity or any means. Link to comment Share on other sites More sharing options...
Ralph Posted August 5, 2016 Share Posted August 5, 2016 3 minutes ago, Iszard said: I'm running into the same problem with static / kinematic bodies. Personally I want near pixel perfect collision detection without transferring velocity or any means. Only one of the objects should have body.immovable = true and then they wont transfer velocities. Link to comment Share on other sites More sharing options...
Iszard Posted August 5, 2016 Share Posted August 5, 2016 1 minute ago, Ralph said: Only one of the objects should have body.immovable = true and then they wont transfer velocities. then object not immovable is still rotated or altered and if in a pool with maintain that when reused although params such as rotation or angle still return 0 Link to comment Share on other sites More sharing options...
Ralph Posted August 5, 2016 Share Posted August 5, 2016 Just now, Iszard said: then object not immovable is still rotated or altered and if in a pool with maintain that when reused although params such as rotation or angle still return 0 I dont understand what this means. Link to comment Share on other sites More sharing options...
Iszard Posted August 5, 2016 Share Posted August 5, 2016 without duplicating posts I can easily direct you to my latest post on the subject: Link to comment Share on other sites More sharing options...
VitaZheltyakov Posted August 5, 2016 Share Posted August 5, 2016 23 hours ago, zelcard said: Greetings, is it possible for two immovable objects (object1.body.immovable = true; object2.body.immovable = true;) to collide? If yes how that can be achieved? Thanks! sprite1.body.mass = 99999999; sprite2.body.mass = 99999999; Link to comment Share on other sites More sharing options...
symof Posted August 6, 2016 Share Posted August 6, 2016 @Iszard @zelcard What you are looking for is not collision but overlap. http://phaser.io/docs/2.6.1/Phaser.Physics.Arcade.Body.html#onOverlap http://phaser.io/examples/v2/sprites/overlap-without-physics Collision means that two physical bodies hit each other and each of the bodies needs to react to the physics that a collision imply. Overlap is just about one sprite being on top(overlapping) another sprite. Link to comment Share on other sites More sharing options...
Iszard Posted August 6, 2016 Share Posted August 6, 2016 4 minutes ago, symof said: @Iszard @zelcard What you are looking for is not collision but overlap. http://phaser.io/docs/2.6.1/Phaser.Physics.Arcade.Body.html#onOverlap http://phaser.io/examples/v2/sprites/overlap-without-physics Collision means that two physical bodies hit each other and each of the bodies needs to react to the physics that a collision imply. Overlap is just about one sprite being on top(overlapping) another sprite. can you help with overlap then with pixel perfect collision detection because as fair as I know it's bounds are the image rect. Link to comment Share on other sites More sharing options...
symof Posted August 6, 2016 Share Posted August 6, 2016 @Iszard http://stackoverflow.com/questions/2272179/a-simple-algorithm-for-polygon-intersection http://phaser.io/examples/v2/input/pixel-perfect-click-detection There is no quick fix, time to start reading up on overlaps. And that's pretty much it. You want a very niche type of collision, then you need to make it. But. You. Don't. Need. Pixel. Perfect. Collisions. In. Games. Also important to note are the software/hardware restrictions of said physics engine. P2 is considered Advanced and having more then 50 physics bodies will start causing serious frame drop on most devices. If you have 5 players and they each shoot 10 bullets you will have reached that limit in a blink. And now you should stop posting here as this does not relate to the OP's topic(aka topic hijacking). Link to comment Share on other sites More sharing options...
Iszard Posted August 6, 2016 Share Posted August 6, 2016 18 minutes ago, symof said: @Iszard http://stackoverflow.com/questions/2272179/a-simple-algorithm-for-polygon-intersection http://phaser.io/examples/v2/input/pixel-perfect-click-detection There is no quick fix, time to start reading up on overlaps. And that's pretty much it. You want a very niche type of collision, then you need to make it. But. You. Don't. Need. Pixel. Perfect. Collisions. In. Games. Also important to note are the software/hardware restrictions of said physics engine. P2 is considered Advanced and having more then 50 physics bodies will start causing serious frame drop on most devices. If you have 5 players and they each shoot 10 bullets you will have reached that limit in a blink. And now you should stop posting here as this does not relate to the OP's topic(aka topic hijacking). Done all this reading already but no need to further this topic (aka topic hijacking) Link to comment Share on other sites More sharing options...
Ralph Posted August 6, 2016 Share Posted August 6, 2016 1 hour ago, Iszard said: can you help with overlap then with pixel perfect collision detection because as fair as I know it's bounds are the image rect. Do you mean you want collision to happen whenever the actual sprite image overlaps, and not when the transparent parts do? Link to comment Share on other sites More sharing options...
Recommended Posts