Jump to content

P2 Physics body repels everything


DaveSomething
 Share

Recommended Posts

Hi all,

 

I've got the bare beginnings of a space-based game. I'm attempting to move from Arcade physics to P2 physics, to make use of the various constraints (I want to connect objects with chains or elastic springs or something; this seems very hard in Arcade and very easy in P2). 

 

The problem I'm encountering is, when I add my planet sprite, it seems to repel everything else that has been added. I can't figure out why. 

 

If I have one or two asteroids (no planet), the asteroids drift along just fine. 

If I have some asteroids and a spaceship, everything's fine. 

But if I have a planet in the middle, then the asteroids/spaceships immediately fly away from the planet. Their velocity jumps by several thousand in between the first update() call and the second one. 

 

The sprite.body.force is 0. I can't find anything that is explicitly setting the velocity of the objects after their construction. 

I've set applyGravity to false. 

 

I'm completely new to P2, so I'm at a loss for what else to look for. Does anyone have any suggestions for a starting point? 

 

Or, does anyone know of a reasonable way to get something similar to the P2 constraint/spring behavior under Arcade physics?

 

Thanks!

Link to comment
Share on other sites

 Share

  • Recently Browsing   0 members

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