Dont move dynamic bodies when collide

A place to discuss everything related to Newton Dynamics.

Moderators: Sascha Willems, walaber

Dont move dynamic bodies when collide

Postby FSA » Fri Apr 13, 2012 1:00 pm

Hi. Is it possible, when my playerbody(PlayerControllerJoint attached) collide with dynmaic body, that the dynamic Body dont move an the player body stops? Like staticbody collision :) I want to make a player like Amnesia and Penumbra.
I hope you can understand my problem :oops:
User avatar
FSA
 
Posts: 322
Joined: Wed Dec 21, 2011 9:47 am

Re: Dont move dynamic bodies when collide

Postby Julio Jerez » Fri Apr 13, 2012 1:32 pm

you can with any version but it si too contrived, I am adding a special objects that will make that very trivial with core300

Basically there represenation of teh body in the worl din core 300 will be the collision intance,
therefore in next check in, you will be able to make a collision proxy and do whe ever you want with it.

basically a collision proxy will be like a body, but will no genereta force reation, it will act like at static body.
by setting the shape as a trigger then the proxy will be invisible to the body, but the proxy will see the body.
Julio Jerez
Moderator
Moderator
 
Posts: 12426
Joined: Sun Sep 14, 2003 2:18 pm
Location: Los Angeles

Re: Dont move dynamic bodies when collide

Postby JoeJ » Fri Apr 13, 2012 2:43 pm

Also note that Penumbra is open source meanwhile, so you could take a look there how they did it.

If I get you right, you could raycast around the player, and if a body is detected - prohibit moving further in that direction.
I belive the player controller itself uses a technique like that to detect ground, source code in joint library.

Julios suggestion sounds easier to implement, but still requires some work, if I get both of you right:
1. Detect all bodies near player.
2. For each of them create an extruded clone proxy.
3. This ensures that - if nothing moves to fast - collision with proxy will be detected first and further movement against the real body can be avoided.

I know both games, but never realized that they brohibit movement against dynamic bodies.
What's wrong with the usual behaviour - player can move some objects by moving 'into' them, but can't move others if their mass and friction is too high?
Maybe changing mass and friction values can produce the effect you want without any extra work for you and cpu.
User avatar
JoeJ
 
Posts: 1489
Joined: Tue Dec 21, 2010 6:18 pm

Re: Dont move dynamic bodies when collide

Postby FSA » Fri Apr 13, 2012 4:34 pm

@Julio Jerez
Is in core 300 already some kind of this Object? If so can you give me an example how to use it?
@JoeJ
I have already checked Penumbra and HPL sourcecode but can't find a solution :cry:

I have read in Bullet documentation that this kind of player is an kinematic body. So if this kind of body already implemented i would be glad if you can give me an example how to use it :D
Tank you.
User avatar
FSA
 
Posts: 322
Joined: Wed Dec 21, 2011 9:47 am

Re: Dont move dynamic bodies when collide

Postby Edward10 » Fri Nov 16, 2012 8:52 am

The problem is that two non-dynamic bodies are colliding. It's incorrect because kinematic and static bodies should not collide the each other. Such collision are ignored by box2d. But it is happening in your situation. Please provide some phys initialization code for more detailed answer why it's happening.
Edward10
 

Re: Dont move dynamic bodies when collide

Postby FSA » Fri Nov 16, 2012 3:06 pm

The problem has been fixed with the new core 300 player controller ;)
User avatar
FSA
 
Posts: 322
Joined: Wed Dec 21, 2011 9:47 am

Re: Dont move dynamic bodies when collide

Postby Julio Jerez » Fri Nov 16, 2012 3:32 pm

Edward10 wrote:The problem is that two non-dynamic bodies are colliding. It's incorrect because kinematic and static bodies should not collide the each other.

yes all of those issues has being addresed with the Kinematic body based player controller in core 300
download the SDK and try it out
Julio Jerez
Moderator
Moderator
 
Posts: 12426
Joined: Sun Sep 14, 2003 2:18 pm
Location: Los Angeles


Return to General Discussion

Who is online

Users browsing this forum: No registered users and 3 guests