How to rotate & collide

webjeff
Posts: 15
Joined: Tue Dec 16, 2008 1:46 am

How to rotate & collide

Post by webjeff »

I have 2 very simple questions. I'm new to Bullet, but not new to programming.

My questions are...

1) I have a model in which I can move forward and back using "applyCentralImpulse". How should I go about steering this object? Should I use some RigidBody function to apply a rotational force to rate my object? My object is a bumber car with no wheels so I do not want to use the wheeled helper class. I have it moving, I just need to know if I should roate it on my own and just have it move or if there is a rotational force I can apply.

2) Is there any documentation on simple collision handling? I only see the CollisionDemo, but I am wondering if there is any text or documentation regarding the philosophy behind handling collisions.

Thanks
Jeff.
sparkprime
Posts: 508
Joined: Fri May 30, 2008 2:51 am
Location: Ossining, New York

Re: How to rotate & collide

Post by sparkprime »

if it's powered by wheels, apply forces to the chassis to mimic the wheels

if it's powered by rocket thrusters, do the same thing

if it's powered by something magical, you can do whatever produces the visual effect you want, perhaps applying torques? or maybe controlling the angular velocity directly
webjeff
Posts: 15
Joined: Tue Dec 16, 2008 1:46 am

Re: How to rotate & collide

Post by webjeff »

sparkprime,

Thanks for your response. I implemented my own rotation, so I just rotate and then I use "applyCentralImpulse" to thrust forward. Does that seem right? I'm just trying to simulate a fake bumber car (no wheels). It seems to work, I'm now just adjusting the friction so it won't appear like pure ice, but has some friction on which its sliding.

Thanks
Jeff.
sparkprime
Posts: 508
Joined: Fri May 30, 2008 2:51 am
Location: Ossining, New York

Re: How to rotate & collide

Post by sparkprime »

From the information you gave it seems more likely that you should be applying forces, not impulses. Impulses are for instantaneous knocks and per-internal-step movements needed for vehicle suspension and so on. Forces are what you should use to apply a force for the duration of a frame.
webjeff
Posts: 15
Joined: Tue Dec 16, 2008 1:46 am

Re: How to rotate & collide

Post by webjeff »

Thanks,

I've changed and am now calling applyCentralForce which seems to working (sort of)...

I created a btBoxShape and a ground. I'm trying to move it around with forces in the direction it's facing. Mass is 10; World Gravity is (0,-10,0); Friction is 0.5;

1) When the object moves, it slides for a long time. I tried changing the friction, but then I can't move the object. I'm trying to find the sweat spot of moving it, but it should stop promptly when your not adding force to it. Is that in the friction? I've also messed with dampening with no luck.

2) For some reason, my object will stop and when I apply force "applyCentralForce" it seems stuck. When I move it before it hits the ground, it seems fine. Any clues on that?

Thanks
Jeff.
sparkprime
Posts: 508
Joined: Fri May 30, 2008 2:51 am
Location: Ossining, New York

Re: How to rotate & collide

Post by sparkprime »

webjeff wrote:Thanks,

1) When the object moves, it slides for a long time. I tried changing the friction, but then I can't move the object. I'm trying to find the sweat spot of moving it, but it should stop promptly when your not adding force to it. Is that in the friction? I've also messed with dampening with no luck.
Damping should work for you... Note that you can change the friction on both surfaces and i think they both play a role in the dynamics.
2) For some reason, my object will stop and when I apply force "applyCentralForce" it seems stuck. When I move it before it hits the ground, it seems fine. Any clues on that?
Bodies will fall asleep when they haven't moved for a while. To wake them up, call activate() on them or something like that.