Ground interaction question

radrevere
Posts: 3
Joined: Sat Sep 06, 2008 8:53 pm

Ground interaction question

Post by radrevere »

I have gotten Bullet to work successfully with Ogre in a simple test. I have the ground setup as a 'flat' cube and a cube that will be the 'player' on that ground. I have been able to move/slide the object in the standard 4 directions on the plain (North, South, East, West) without a problem using setLinearVelocity().

The problem I run into is when I want to orient the cube to the direction it is moving. As soon as I change its orientation the cube bounces into the air. Following is basically what I am doing:

Code: Select all

myQuat = obj->getWorldTransform();
myQuat.setRotation(yaw, pitch=0, roll=0);
//depending on direction yaw is set to 0, PI, -PI/2 or PI/2
obj->setWorldTransform(myQuat);
First off this bounce doesn't make sense as the object is only spinning to face a different direction. Second, is there a clean way to prevent the bounce or is it best to follow the 'character demo' and implement my own collision response?
Thanks
radrevere
Posts: 3
Joined: Sat Sep 06, 2008 8:53 pm

Re: Ground interaction question

Post by radrevere »

After looking further into it I discovered that the sudden start or stop gives an angular velocity in the y direction :oops: Zeroing out the angular velocity after the rotation was the only way to eliminate the problem but this comes with its own side-effects.

Right now the objects act like they are all made of rubber. Is there a reference to the properties of the object? (mass, friction, angular factor, dampening and any other settings that apply) It would be nice to have a ball-park for materials to narrow down the tweaking. I figure that setting the material to something like wood may help dampen the bounce so I can keep the angular velocity.
User avatar
Erwin Coumans
Site Admin
Posts: 4221
Joined: Sun Jun 26, 2005 6:43 pm
Location: California, USA

Re: Ground interaction question

Post by Erwin Coumans »

If you want to have player control, it is indeed best to follow the 'character demo', and implement your own collision response.
You could try to apply impulses to dynamic objects.

We will improve this character demo with dynamic object interaction "at some stage". Hopefully we receive some contribution for improvements in this area.
Thanks,
Erwin
radrevere
Posts: 3
Joined: Sat Sep 06, 2008 8:53 pm

Re: Ground interaction question

Post by radrevere »

I will try the impulse to see what results it gives. I also found out that I was using step simulation incorrectly which added to the erratic behavior ("stepping the world" article was extremely helpful). Not only was I getting the 'bounce' but the simulation also looked like it was on the moon which led me down the path of investigating stepSimulation.

I think I will look closer at the character demo and if I come up with any improvements I will try to contribute. Thanks for you help.