Цитата:
|
Apply an impulse at a point. This immediately modifies the velocity. It also modifies the angular velocity if the point of application is not at the center of mass. This wakes up the body.
|
- из руководства... хотя это понятно итак

Код AS1/AS2:
public function ApplyImpulse(impulse:b2Vec2, point:b2Vec2) : void{
if (m_type != b2_dynamicBody)
{
return;
}
if (IsAwake() == false)
{
SetAwake(true);
}
//m_linearVelocity += m_invMass * impulse;
m_linearVelocity.x += m_invMass * impulse.x;
m_linearVelocity.y += m_invMass * impulse.y;
//m_angularVelocity += m_invI * b2Cross(point - m_sweep.c, impulse);
m_angularVelocity += m_invI * ((point.x - m_sweep.c.x) * impulse.y - (point.y - m_sweep.c.y) * impulse.x);
}
Добавлено через 1 минуту
m_invMass это 1 поделить на массу