Hey
I have the HelloWorld example compiled and working under QT on windows7. All good so far.
With the origin of the groundTransform set to (0, -56, 0), the demo behaves as I would expect, i.e. the sphere dropping on the y axis. I look at the worldTransform transformation as per the demo. After 100 ticks, the world pos of the sphere is (2.000000,-4.027782,0.000000)
However, if I set the groundTransform set to (0, 0, 0), i.e. groundShape centred on the axis origin, I get unexpected behaviour. I suspect it's my understanding of what's going on, but I really need to understand. I get small movement in the x and z axis, and significant movement in the y axis. After 100 ticks, the world pos of the sphere is (2.113249,816.245667,-0.000094).
The code of the demo is unmodified apart from changing the origin position of the ground shape.
I would appreciate it if someone could explain what I am seeing.
Cheers
Matt
HelloWorld demo
-
- Posts: 6
- Joined: Thu May 26, 2011 8:36 pm
Re: HelloWorld demo
Hi,
I am very new to bullet as well, so I am not one hundred percent confident here, but I believe what you are seeing is the RigidBody being launched into the air because its CollisionShape is intersecting with the ground. If you are using the default sphere radius of 1 and an origin of (0,0,0) for both the sphere and the ground then this is probably what you are seeing. However, there is also the fact that when you specify the plane collision shape you have to specify the origin of the plane as (0,1,0) because bullet seems to use the origin to calculate the normal of the plane as well. This (I think) is why the HelloWorld tutorial specifies (0,1,0) and (0,-1,0) for the plane positions.
Tim
I am very new to bullet as well, so I am not one hundred percent confident here, but I believe what you are seeing is the RigidBody being launched into the air because its CollisionShape is intersecting with the ground. If you are using the default sphere radius of 1 and an origin of (0,0,0) for both the sphere and the ground then this is probably what you are seeing. However, there is also the fact that when you specify the plane collision shape you have to specify the origin of the plane as (0,1,0) because bullet seems to use the origin to calculate the normal of the plane as well. This (I think) is why the HelloWorld tutorial specifies (0,1,0) and (0,-1,0) for the plane positions.
Tim
-
- Posts: 4
- Joined: Thu May 26, 2011 9:49 am
Re: HelloWorld demo
Thanks for that. I think I am starting to understand. However, the 2.78 Bullet HelloWorld demo uses a btBoxShape and not a plane as shown in the wiki example. Effectively, using 0,-56,0 means that the sphere and the box aren't actually overlapping at the start. I guess by setting the groundshape to have an origin such that it encompasses the sphere (e.g. 0,0,0) means that there is always a physical reaction.
If this is true, how do I set up a constrained world such that it would be constrained the limits of a boxshape for example and not have the phisical reaction when a sphere is located inside that constrained space.
Help, guidance much appreciated.
If this is true, how do I set up a constrained world such that it would be constrained the limits of a boxshape for example and not have the phisical reaction when a sphere is located inside that constrained space.
Help, guidance much appreciated.
-
- Posts: 6
- Joined: Thu May 26, 2011 8:36 pm
Re: HelloWorld demo
I am not quite clear what you mean by constrained. I think what you are asking is how do you overlap two btRigidBodies without them interacting? If so, you can use collision masking, which is sort of like setting objects to layers. You call btRigidBody->setCollisionFlags(int) where int is the collision flag for the object type. If you decide to use this, refer to page 20 of the manual and also the wiki, because it seems there may have been changes to how this works.
-
- Posts: 4
- Joined: Thu May 26, 2011 9:49 am
Re: HelloWorld demo
Excellent, thanks for that.
-
- Posts: 66
- Joined: Sun Jan 30, 2011 8:46 pm
Re: HelloWorld demo
If you specify the sphere to be at 0,0,0 then it will penetrate the ground and will be moved out. But perhaps you can try placing the sphere at y = radius of sphere. This will ensure the sphere is exactly above the ground. However here is the rub. If you are using a box shape then the height of the box(along the y axis) also makes a difference. Boxes are placed centered around the origin(for all 3 axes) unless you specify some initial transform. So if your box is of ht = 0.1 m, then 0.05m of it is above the y axis and 0.05 is below. So your sphere will be still only if you place it at y = radius + 0.05m
-
- Posts: 1
- Joined: Wed Jun 22, 2011 7:58 am
Re: HelloWorld demo
I am new in bullet. I think i can learn what i don't have before.
I really want to know physics world.
thanks brother for comments i really happy
to your post. that post really good for every learner.
I really want to know physics world.
thanks brother for comments i really happy
to your post. that post really good for every learner.