Box2D Forums

It is currently Fri May 24, 2013 9:06 pm

All times are UTC - 8 hours [ DST ]




Post new topic Reply to topic  [ 3 posts ] 
Author Message
PostPosted: Sat Jan 14, 2012 10:40 pm 
Offline

Joined: Sat Jan 14, 2012 2:53 am
Posts: 3
In my game, I need a magnet that attracts objects around it.
So, basically I need an attractive / repulsive force focused at a single point whose strength decreases with distance.
Is this doable with box2d ?
I couldn't figure it out. Any ideas on how to do it?
Thanks in advance!


Top
 Profile  
 
PostPosted: Sun Jan 15, 2012 12:40 am 
Offline

Joined: Tue Jun 24, 2008 8:25 pm
Posts: 1517
Location: Tokyo
You can apply a force to the bodies depending on how close they are. This is a little similar, might give you the idea:
http://stackoverflow.com/questions/6758 ... sing-box2d


Top
 Profile  
 
PostPosted: Sun Jan 15, 2012 5:16 am 
Offline

Joined: Sat Jan 14, 2012 2:53 am
Posts: 3
Thanks.. that helps.


Top
 Profile  
 
Display posts from previous:  Sort by  
Post new topic Reply to topic  [ 3 posts ] 

All times are UTC - 8 hours [ DST ]


Who is online

Users browsing this forum: Google [Bot] and 2 guests


You cannot post new topics in this forum
You cannot reply to topics in this forum
You cannot edit your posts in this forum
You cannot delete your posts in this forum
You cannot post attachments in this forum

Search for:
Powered by phpBB® Forum Software © phpBB Group