Follow-up Comment #8, task #5925 (project wormux):
Sorry for being late but we can use a true physics computation :
void WeaponBullet::SignalObjectCollision(PhysicalObj * obj, const Point2d&
my_speed_before)
{
double total_mass = GetMass() + obj->GetMass();
// computing new speed of character
Point2d v2 = (my_speed_before * (1 + 0.8) * GetMass() +
obj->GetSpeed() * (obj->GetMass() - 0.8 * GetMass())) /
total_mass;
obj->SetSpeed(v2.x, v2.y);
obj->SetEnergyDelta(-(int)cfg.damage);
// Pushing a little upward character to allow him to be pushed by the
projectile
obj->SetXY(Point2i(obj->GetX(), obj->GetY() - 3));
if (!obj->IsCharacter())
Explosion();
Ghost();
}
As far as I can see, the result is quite good.
_______________________________________________________
Reply to this item at:
<http://gna.org/task/?5925>
_______________________________________________
Message posté via/par Gna!
http://gna.org/
_______________________________________________
Wormux-gna mailing list
[email protected]
https://mail.gna.org/listinfo/wormux-gna