1
This commit is contained in:
parent
a7c031c126
commit
ca3c796c51
@ -15,11 +15,20 @@
|
|||||||
bool Collision::CheckBullet(IBullet* bullet, Creature* c)
|
bool Collision::CheckBullet(IBullet* bullet, Creature* c)
|
||||||
{
|
{
|
||||||
glm::vec3 bullet_real_pos = bullet->GetPos().ToGlmVec3() - bullet->GetDir() * bullet->GetHitRadius();
|
glm::vec3 bullet_real_pos = bullet->GetPos().ToGlmVec3() - bullet->GetDir() * bullet->GetHitRadius();
|
||||||
return a8::IntersectCylinderCylinder
|
bool ret = a8::IntersectCylinderCylinder
|
||||||
(
|
(
|
||||||
bullet_real_pos, bullet->GetHitRadius() * 1.0, 10,
|
bullet_real_pos, bullet->GetHitRadius() * 1.0, 10,
|
||||||
c->GetPos().ToGlmVec3(), c->GetHitRadius(), 10
|
c->GetPos().ToGlmVec3(), c->GetHitRadius(), 10
|
||||||
);
|
);
|
||||||
|
if (!ret) {
|
||||||
|
bullet_real_pos = bullet->GetPos().ToGlmVec3() - bullet->GetDir() * (bullet->GetHitRadius() - 2);
|
||||||
|
ret = a8::IntersectCylinderCylinder
|
||||||
|
(
|
||||||
|
bullet_real_pos, bullet->GetHitRadius() * 1.0, 10,
|
||||||
|
c->GetPos().ToGlmVec3(), c->GetHitRadius(), 10
|
||||||
|
);
|
||||||
|
}
|
||||||
|
return ret;
|
||||||
}
|
}
|
||||||
|
|
||||||
bool Collision::CheckBullet(IBullet* bullet, Entity* e)
|
bool Collision::CheckBullet(IBullet* bullet, Entity* e)
|
||||||
|
Loading…
x
Reference in New Issue
Block a user