1
This commit is contained in:
parent
5205f1d36b
commit
57c03c8499
@ -20,6 +20,7 @@
|
||||
#include "ability.h"
|
||||
#include "buff.h"
|
||||
#include "collision.h"
|
||||
#include "mapinstance.h"
|
||||
|
||||
#include "mt/Param.h"
|
||||
#include "mt/Equip.h"
|
||||
@ -930,4 +931,18 @@ const Position& Bullet::GetPos()
|
||||
void Bullet::Raycast()
|
||||
{
|
||||
raycasted_ = true;
|
||||
glm::vec3 start = born_pos.ToGlmVec3();
|
||||
glm::vec3 end = born_pos.AddGlmVec3(born_dir * (float)gun_meta->range()).ToGlmVec3();
|
||||
|
||||
bool hit_result = false;
|
||||
glm::vec3 hit_point;
|
||||
sender.Get()->room->map_instance->Scale(start);
|
||||
sender.Get()->room->map_instance->Scale(end);
|
||||
bool ret = sender.Get()->room->map_instance->Raycast(0, start, end, hit_point, hit_result);
|
||||
if (ret) {
|
||||
sender.Get()->room->map_instance->UnScale(hit_point);
|
||||
raycast_len_ = GlmHelper::Norm(hit_point - born_pos.ToGlmVec3());
|
||||
} else {
|
||||
raycast_len_ = 0.0f;
|
||||
}
|
||||
}
|
||||
|
Loading…
x
Reference in New Issue
Block a user