This is kind of two questioner, but related.
In the HelloWorldApp, the object is to get a ball bouncing on a box right? If I wanted to test a plane, could I just add in a btCollisionObject with a btStaticPlaneShape instead of the box?
How can I set custom restitution, static and kinetic friction per object?
Ball Bouncing
-
- Posts: 4
- Joined: Sat Nov 26, 2011 12:12 am
Re: Ball Bouncing
Is there perhaps a better place to ask this?
-
- Posts: 237
- Joined: Tue Jun 29, 2010 10:27 pm
Re: Ball Bouncing
In the current version of the Hello World tutorial I see, it is already using btStaticPlaneShape, not btBoxShape: http://bulletphysics.org/mediawiki-1.5. ... ello_Worldmmurphy wrote: In the HelloWorldApp, the object is to get a ball bouncing on a box right? If I wanted to test a plane, could I just add in a btCollisionObject with a btStaticPlaneShape instead of the box?
Check the API Reference:mmurphy wrote:How can I set custom restitution, static and kinetic friction per object?
btCollisionObject::setFriction(btScalar frict)
btCollisionObject::setRestitution(btScalar rest)
Alternatively you can set these values in the btRigidBodyConstructionInfo when the object is set up (rbci.friction = ... , rbci.restitution = ... ).
-
- Posts: 4
- Joined: Sat Nov 26, 2011 12:12 am
Re: Ball Bouncing
Ah, I must have missed that. The reason I was asking is because for some odd reason, when the ball will hit the box it will just immediately stay there, and never bounce. Do you happen to know of any off chance why this may happen?dphil wrote:Interesting ... it appears that either the doc or the source is out of date (I have 2.79, which I downloaded about two weeks ago).mmurphy wrote: In the current version of the Hello World tutorial I see, it is already using btStaticPlaneShape, not btBoxShape: http://bulletphysics.org/mediawiki-1.5. ... ello_World
dphil wrote:mmurphy wrote: Alternatively you can set these values in the btRigidBodyConstructionInfo when the object is set up (rbci.friction = ... , rbci.restitution = ... ).
Also, I could look into where the collision event is resolved/reported. I do not see where that is though, would you be able to clue me on where that is happening?
-
- Posts: 237
- Joined: Tue Jun 29, 2010 10:27 pm
Re: Ball Bouncing
Hm, you're right. I just tried it out and the sphere bounces nicely on a plane, but only a little bit or not at all when dropped on a box shape (with the exact same rigid body settings as the plane). Offhand I don't know why...though I seem to recall this being discussed before. I know other people have had issues with restitution behaving oddly at times.
[quote=mmurphy]Also, I could look into where the collision event is resolved/reported. I do not see where that is though, would you be able to clue me on where that is happening?[/quote]
I'm not exactly sure; I don't normally dig into that part of the engine, so maybe someone else can help. My naive approach would be to start in btDynamicsWorld's stepSimulation function and go from there, following the relevant-looking calls.
[quote=mmurphy]Also, I could look into where the collision event is resolved/reported. I do not see where that is though, would you be able to clue me on where that is happening?[/quote]
I'm not exactly sure; I don't normally dig into that part of the engine, so maybe someone else can help. My naive approach would be to start in btDynamicsWorld's stepSimulation function and go from there, following the relevant-looking calls.
-
- Posts: 171
- Joined: Sun Jan 17, 2010 4:47 am
Re: Ball Bouncing
I don't really have an answer to this per-se, but I've seen both others on this forum and from my own experiments that some behaviors...friction and restitution especially can vary greatly from the use of one shape to another. As best I can tell this has to do with the different collision algorithms that get set for a given pair of objects which are based on the shape rather then the body.
Usually box shapes are the most reliable. So there being a problem with boxes is a little surprising.
Usually box shapes are the most reliable. So there being a problem with boxes is a little surprising.
-
- Posts: 4
- Joined: Sat Nov 26, 2011 12:12 am
Re: Ball Bouncing
Does anyone else possibly know why I might be having this issue?