Pseudo-magnet implementation with chipmunk

Posted by Eimantas on Game Development See other posts from Game Development or by Eimantas
Published on 2011-03-18T09:48:49Z Indexed on 2011/03/18 16:19 UTC
Read the original article Hit count: 226

Filed under:
|

How should I go about implementing "natural" magnet on a certain body in chipmunk space? Context is of simple bodies lying in the space (think chessboard). When one of the figures is activated as a magnet - others should start moving towards it.

Currently I'm applying force (cpBodyApplyForce)to the other figures with vector calculated towards the activated figure. However this doesn't really feel "natural". Are there any known algorithms for imitating magnets?

© Game Development or respective owner

Related posts about 2d-physics

Related posts about chipmunk