[SOLVED] How to perform elastic collisions?

mant
Posts: 6
Joined: Mon Mar 11, 2013 8:15 am

[SOLVED] How to perform elastic collisions?

Post by mant »

Hello everyone. I have some problems in performing elastic collisions.

If I use

body->setActivationState(DISABLE_DEACTIVATION);
body->setLinearVelocity(vec);

the two objects collide (objects with the same attributes) and move together at a speed V/2 m/s
V is the initial speed.

I want to get the result like this example.
Distance between two objects: 10m;
Object1 has an initial speed of 10m/s;
It will collide with the second object and give it's full velocity to Object2;
After collision, Object2's speed is 10m/s, Object1 doesn't move anymore.

Could someone please tell me how to make the right settings?
Thank you for reading and helping.




____________________________________
This thread has been solved.
Solution: use RidgidBody->setRestitution(1);
to let Bullet perfroms elastic collisions.
Last edited by mant on Fri Dec 13, 2013 1:49 am, edited 2 times in total.
papaonn
Posts: 41
Joined: Wed Nov 20, 2013 4:14 pm

Re: How to set initial Velocity?

Post by papaonn »

Hi,

Try setting the linear velocity at 1 frame only, and after next frame reset it to zero.
Ateocinico
Posts: 12
Joined: Sat Jun 29, 2013 5:55 pm

Re: How to set initial Velocity?

Post by Ateocinico »

The answer is given by physics. If you don't want the physics use only collision detection and set all the speeds yourself. Or you can give the first object more mass the second.
mant
Posts: 6
Joined: Mon Mar 11, 2013 8:15 am

Re: How to set initial Velocity?

Post by mant »

Thank you both for replying :D.
I'm trying to perform elastic collisions. Sorry for my bad writing.


Update: This thread has been solved as I found the solution.