add a speed to the speed of a RigidBody

Xemame
Posts: 8
Joined: Mon Dec 20, 2010 3:47 pm

add a speed to the speed of a RigidBody

Post by Xemame »

Hello!

I am using a webcam and I managed to get my silhouette. It is in 2D and it is store in a list of points. Each point as its speed.
I want to make it collides with RigidBodies :D

My first point is: is it possible to make an Bullet object corresponding to my silhouette, so it will collide with RigidBodies? The difficulty is the number of 2D points changes all the time and each point has its own speed. Besides, The silhouette is in 2D.

My second point is: I think about computing the collision between my silhouette and the RigidBodies by myself: If a RigidBody is in contact with the silhouette, I know the speed of both, so I can compute the speed given to the RigidBody: http://en.wikipedia.org/wiki/Elastic_collision.
However, I do not know how to do so the RigidBody gets this speed. I try to avoid using setLinearVelocity because if there are collisions with other RigidBodies or other silhouettes during the same step simulation, they will not influence the resulting speed, since the last collision with a silhouette will erase everything. I saw applyCentralImpulse, but I do not know if it allows to influence the speed as I want.
Any ideas to add this speed to the current speed of the RigidBody?

Thanks a lot!!!
winspear
Posts: 77
Joined: Thu Nov 26, 2009 6:32 pm

Re: add a speed to the speed of a RigidBody

Post by winspear »

Bullet is a physics engine, so all objects act according to the Newtonian physics.
In real life . if you want to slide a box on the floor in a particular direction, you apply a force on the box and then the box moves according to the force applied.

Similarly, objects in the physics world can be moved by applying a force on them.

For your project, a cool thing to try would be to create a physical ragdoll in Bullet with joints (shoulder, elbow, knee, hip, neck etc..) and then have a way to actuate those joints by your motion capturing algorithm.
Look at the ragdoll demo to get an idea of what a physical ragdoll will look like. This physical ragdoll can then automatically interact with all the other physical rigid bodies/ soft bodies in the scene.
Xemame
Posts: 8
Joined: Mon Dec 20, 2010 3:47 pm

Re: add a speed to the speed of a RigidBody

Post by Xemame »

It would be great, but I do not have informations about the position of the hands, of the knees and so on :(
Thus, I cannot use the ragdoll.
My algorithm just tells there is a shape in front of the camera. It may match a ragdoll, but it also may be several people, or somebody with someting in the hands (then, this object would be in the shape).

Anyway, good idea.