Jump to content

immovable to certain bodies only?


Elgan
 Share

Recommended Posts

like with overlap and collide. 

 

is it possible to make up a callback for immovable, so that it will only be affected with certain bodie?

 

 

for example a player hitting it, doesnt push it...but it still collides into walls if he kicks it and (applys velocity)

 

 

Link to comment
Share on other sites

I can't think of a good solid way to solve this one with Arcade physics. You want walls to not be immovable but simply have so much mass that it takes a large force (such as kicking) to move them, which to me suggests P2 physics instead. You could use processCallback to set body.immovable to false temporarily, but that will mean that all collisions will suddenly start affecting that wall for the duration, and you'd also need to start running another collision loop between that moving piece of wall and all other walls, if not doing so already.

 

It's an awkward problem based on the fact that it doesn't make much sense in real life, and the physics systems are trying to simulate something approximating real life forces. It may be a case for you having to manually create a simple physics system for this kind of action (which isn't as daunting as you'd assume) unless anyone has a better idea of doing this in a really fool-proof way?

Link to comment
Share on other sites

it is a strange one.

basically:

 

 

dont move if you walk into it. Collides with playerwa

Do move if player kicks it, 
cif moving, collides with walls  

 

 

basically immovable only to players walking.

 

i have got round this with tile callbacks and collisions processes and hits..but its messy and im not sure it will even work if the 2 players hit it at the same or similar times, one kicking , one not.

 

i did build this in cocos2dx-html and buuilt my own physics system which works peerfect but i cant easily transfer it as it handled all movement, players too.

 

i could hack the game when doing immovable checks to test the entitty first, but a pain on phaserjs updates. Could be a fantastic feature to add though?

 

its simly i shouldnt be able to push the ball without kicking it, but it should hit walls. nightmare

Link to comment
Share on other sites

 Share

  • Recently Browsing   0 members

    • No registered users viewing this page.
×
×
  • Create New...