Integration issues

SiWi
Posts: 9
Joined: Sat Aug 23, 2008 1:36 pm

Integration issues

Post by SiWi »

Ok, first of all hi @ all, as this is my first post.
I'm working with a Python wrap of Bullet included in the PythonOgre package.
I'm trying to integrate bullet in my application, which uses Ogre for rendering.
I've also done some very basic integration of bullet, which should work in my eyes, but the Physics aren't doing what I expect them to do. :)
In my setup I have a static rigid body with a boxshape of the size 500,10,500 as ground floor. My first question is about this floor:
When I create a new transform as initalTransform for the floor's motion state and set the transform to identity and afterwards set the origin to 0, 100, 0, then the floor's center is at 0, 100, 0 right?
When I create a dynamic rigid body with a capsule shape afterwards and set its initalTransform's origin to 100, 150, 100 then the capsule should fall on the floor and stop on it, right?
But i have two problems with this:
Printing out the two bodies positions via motionState, i notice two things:
1. The capsule's y position gets smaller very fast ad isn´t stopping at the floor y postition and the x and z position slowly increase without applying a force.
2. Why does the floor's motionState return 500,10,500(the Shape's half extents) as it's position and not 0,100,0?
What have i done wrong in my setup?
One last question: When implementing an own version of btIDebugDrawer, what else, but drawLine do you have to override in your inherited class?
AxeD
Posts: 36
Joined: Tue Jun 17, 2008 8:28 pm

Re: Integration issues

Post by AxeD »

Hi,
tell me what is your gravity for all objects, what is a mass of capsule and what are a sizes of a capsule. Sometimes when object (floor) is not thick enough and step of simulation is too long you may have tunneling.

Best regards
SiWi
Posts: 9
Joined: Sat Aug 23, 2008 1:36 pm

Re: Integration issues

Post by SiWi »

World Gravity is set to 0, -10, 0. Mass of the capsule is 1. Size is height=1 and radius=0,5.
sparkprime
Posts: 508
Joined: Fri May 30, 2008 2:51 am
Location: Ossining, New York

Re: Integration issues

Post by sparkprime »

SiWi wrote:Ok, first of all hi @ all, as this is my first post.
In my setup I have a static rigid body with a boxshape of the size 500,10,500 as ground floor. My first question is about this floor:
When I create a new transform as initalTransform for the floor's motion state and set the transform to identity and afterwards set the origin to 0, 100, 0, then the floor's center is at 0, 100, 0 right?
yes, although I can't be certain without seeing code.

assuming you are aware that boxes are actually specified with halfwidths instead of widths, then there should be box between 105 and 95 on the y axis
When I create a dynamic rigid body with a capsule shape afterwards and set its initalTransform's origin to 100, 150, 100 then the capsule should fall on the floor and stop on it, right?
yes
But i have two problems with this:
Printing out the two bodies positions via motionState, i notice two things:
1. The capsule's y position gets smaller very fast ad isn´t stopping at the floor y postition and the x and z position slowly increase without applying a force.
2. Why does the floor's motionState return 500,10,500(the Shape's half extents) as it's position and not 0,100,0?
What have i done wrong in my setup?
This is very strange, I think you are probably setting up the world wrongly, can you try demos or the hello world example:

http://www.bulletphysics.com/mediawiki- ... ello_World
One last question: When implementing an own version of btIDebugDrawer, what else, but drawLine do you have to override in your inherited class?
Can't help you there I'm afraid.
SiWi
Posts: 9
Joined: Sat Aug 23, 2008 1:36 pm

Re: Integration issues

Post by SiWi »

My world setup is exact the same as in the Hello World example. One thing I wonder about in the tutorial is the local offset of the Plane shape. Do I have to watch out for such a thing in my setup of the ground box, too?
Ok, by inserting my code into the hello world example I figured out that the problem was all about my custom motion state, which isn't working as expected because of a Python specific problem.
Thank you for your help.
sparkprime
Posts: 508
Joined: Fri May 30, 2008 2:51 am
Location: Ossining, New York

Re: Integration issues

Post by sparkprime »

SiWi wrote:My world setup is exact the same as in the Hello World example. One thing I wonder about in the tutorial is the local offset of the Plane shape. Do I have to watch out for such a thing in my setup of the ground box, too?
No, boxes wouldn't have this problem.

I think generally with collision shapes, it's probably a good idea if the origin is actually within the shape. For a plane this means the origin should be on the "solid side" of the plane.
Ok, by inserting my code into the hello world example I figured out that the problem was all about my custom motion state, which isn't working as expected because of a Python specific problem.
Thank ou for your help.
np

That was the kind of outcome I was expecing :P