Fix crash when rubber band hits its owner
This commit is contained in:
parent
f61dcb2ec3
commit
3b0df18167
@ -200,8 +200,9 @@ void RubberBand::update(int ticks)
|
|||||||
m_plunger->setKeepAlive(0);
|
m_plunger->setKeepAlive(0);
|
||||||
return;
|
return;
|
||||||
}
|
}
|
||||||
|
// diff can be zero if the rubber band hits its owner
|
||||||
diff.normalize(); // diff can't be zero here
|
if (diff.x() != 0.0f && diff.y() != 0.0f && diff.z() != 0.0f)
|
||||||
|
diff.normalize();
|
||||||
m_owner->getBody()->applyCentralForce(diff*force);
|
m_owner->getBody()->applyCentralForce(diff*force);
|
||||||
m_owner->increaseMaxSpeed(MaxSpeed::MS_INCREASE_RUBBER,
|
m_owner->increaseMaxSpeed(MaxSpeed::MS_INCREASE_RUBBER,
|
||||||
kp->getPlungerBandSpeedIncrease(),
|
kp->getPlungerBandSpeedIncrease(),
|
||||||
|
Loading…
Reference in New Issue
Block a user