mrSully Posted October 1, 2014 Share Posted October 1, 2014 I am working on bouncing one body into a set of others (similar to bowling), but where every collision is calculated individually between two objects. How can I instantly stop the momentum of the colliding object and and transfer it to the object collided with? my thoughts in psuedo: collided.body.velocity.x = colliding.body.velocity.x;collided.body.velocity.y = colliding.body.velocity.y; If this would work, what would my condition in my update() function be to find the moment when the two collide. Simple question, and I'm sure it is very easy, but I do not have access to a testing environment atm and am just looking for some guidance if anyone is familiar Thanks in advance! Sully Link to comment Share on other sites More sharing options...
valueerror Posted October 1, 2014 Share Posted October 1, 2014 that way both bodies would continue to travel in the same direction.. is that what you want? shouldnt the firs body bounce back?i'd use materials and set the restitution to 1.. all the calculations would be done by the physicssystem then.. Link to comment Share on other sites More sharing options...
mrSully Posted October 2, 2014 Author Share Posted October 2, 2014 collided.body.velocity.x = colliding.body.velocity.x;collided.body.velocity.y = colliding.body.velocity.y; colliding.body.velocity.x = 0;colliding.body.velocity.y = 0; that's what I meant. Is there a better practice? Link to comment Share on other sites More sharing options...
Recommended Posts