Box2D Forums

It is currently Thu May 23, 2013 9:25 am

All times are UTC - 8 hours [ DST ]




Post new topic Reply to topic  [ 7 posts ] 
Author Message
PostPosted: Sat Jan 09, 2010 4:20 am 
Offline

Joined: Sat Jan 09, 2010 4:14 am
Posts: 4
Hi, I'm new to box2d, and using jbox2d in my project. I used setXForm to set a static body's position. I moved the body down, and bodies on it dropped. But when I moved the static body up, bodies on it didn't move until the static body was above them, and then they all dropped down. I did the same way with chipmunk and it works. So in jbox2d, how can I move a static body up, and let bodies on it moves up with it?


Top
 Profile  
 
PostPosted: Sat Jan 09, 2010 10:10 am 
Offline

Joined: Mon Jun 08, 2009 12:21 pm
Posts: 353
First of all, which version of JBox2D are you using?

Let me repeat what you said so I'm sure I'm understanding the situation.

You have a static body and dynamic bodies, and the dynamic bodies are sitting on top of the static body. When you move the static body down by just setting the position, the dynamic bodies will fall and correctly bouce/interact with the static body. BUT when you try to set the position of the static body up, the dynamic bodies become 'imbeded' in the static body and don't move back out?


Top
 Profile  
 
PostPosted: Sat Jan 09, 2010 11:08 pm 
Offline

Joined: Sat Jan 09, 2010 4:14 am
Posts: 4
Yes, that's exactly the situation. I'm using JBox2d 2.0.1, and I got it from the sourceforge project.


Top
 Profile  
 
PostPosted: Sat Jan 09, 2010 11:37 pm 
Offline

Joined: Mon Jun 08, 2009 12:21 pm
Posts: 353
At this point, from what I know about the behavior of the engine, I think that the only way for this to behave correctly for you with the 2.0.1 release would be to have that object as a dynamic object, and use joints to anchor it.

Box2D is having it's next point release (should be soon.....), which has the type of moving static body you're talking about, called a kinematic body. I'm working on updating the Java port now, so for now try to use joints with a dynamic body, and when we have the next release it'll be easier.


Top
 Profile  
 
PostPosted: Sun Jan 10, 2010 1:50 am 
Offline

Joined: Sat Jan 09, 2010 4:14 am
Posts: 4
Thank you very much. I'm looking forward the next release. It's really a nice physics engine.


Top
 Profile  
 
PostPosted: Sun Jan 10, 2010 2:02 am 
Offline

Joined: Sat Jan 09, 2010 4:14 am
Posts: 4
Another question, can I continuously filter a collision? It seems that I have to let the dynamic body jump up and fall down to generate a new contact with the static body, and filter the collision. Is there a better way?


Top
 Profile  
 
PostPosted: Sun Jan 17, 2010 1:14 am 
Offline

Joined: Mon Jun 08, 2009 12:21 pm
Posts: 353
I'm really not sure, you could ask around in the general forums though, they might have a solution for you


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

All times are UTC - 8 hours [ DST ]


Who is online

Users browsing this forum: psbot [Picsearch] and 1 guest


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:
cron
Powered by phpBB® Forum Software © phpBB Group