1
This commit is contained in:
parent
4966b2aa98
commit
05458b19da
@ -2334,7 +2334,7 @@ void Creature::SpecDirMove(glm::vec3 dir, float distance)
|
||||
std::vector<dtPolyRef> spec_polys;
|
||||
|
||||
bool hit_result = false;
|
||||
bool ret = room->map_instance->RaycastEx(start, end, hit_point, hit_result, same_polys_flags, spec_polys);
|
||||
bool ret = room->map_instance->RaycastEx(start, end, hit_point, hit_result, same_polys_flags, spec_polys, 0);
|
||||
if (ret) {
|
||||
room->map_instance->UnScale(hit_point);
|
||||
GetMutablePos().FromGlmVec3(hit_point);
|
||||
|
@ -589,7 +589,8 @@ void MapInstance::MarkMapAreaPolys()
|
||||
|
||||
bool MapInstance::RaycastEx(const glm::vec3& start, const glm::vec3& end,
|
||||
glm::vec3& hit_point, bool& hit_result,
|
||||
int& same_polys_flags, std::vector<dtPolyRef>& spec_polys)
|
||||
int& same_polys_flags, std::vector<dtPolyRef>& spec_polys,
|
||||
unsigned short exclude_flags)
|
||||
{
|
||||
same_polys_flags = 0;
|
||||
|
||||
@ -606,7 +607,7 @@ bool MapInstance::RaycastEx(const glm::vec3& start, const glm::vec3& end,
|
||||
dtStatus status = 0;
|
||||
dtQueryFilter filter;
|
||||
filter.setIncludeFlags(0xffff);
|
||||
filter.setExcludeFlags(0);
|
||||
filter.setExcludeFlags(exclude_flags);
|
||||
|
||||
dtPolyRef startRef = INVALID_NAVMESH_POLYREF;
|
||||
{
|
||||
|
@ -45,7 +45,8 @@ class MapInstance : public std::enable_shared_from_this<MapInstance>
|
||||
glm::vec3& hit_point, bool& hit_result);
|
||||
bool RaycastEx(const glm::vec3& start, const glm::vec3& end,
|
||||
glm::vec3& hit_point, bool& hit_result,
|
||||
int& same_polys_flags, std::vector<dtPolyRef>& spec_polys);
|
||||
int& same_polys_flags, std::vector<dtPolyRef>& spec_polys,
|
||||
unsigned short exclude_flags);
|
||||
bool FindNearestPoint(const glm::vec3& center, float radius, glm::vec3& nearestPt);
|
||||
bool GetPosHeight(const Position& pos, float& out_height);
|
||||
dtPoly* GetPoly(glm::vec3 pos, int& poly_idx);
|
||||
|
@ -86,11 +86,15 @@ void Movement::CalcTargetPos(float distance)
|
||||
point.tar_pos.SetZ(10);
|
||||
}
|
||||
} else {
|
||||
unsigned short exclude_flags = 0;
|
||||
if (owner_->GetCar()) {
|
||||
exclude_flags = SAMPLE_POLYFLAGS_DOOR;
|
||||
}
|
||||
glm::vec3 hit_point;
|
||||
owner_->room->map_instance->Scale(start);
|
||||
owner_->room->map_instance->Scale(end);
|
||||
bool ret = owner_->room->map_instance->RaycastEx(start, end, hit_point, hit_result,
|
||||
point.same_polys_flags, point.spec_polys);
|
||||
point.same_polys_flags, point.spec_polys, exclude_flags);
|
||||
if (ret) {
|
||||
owner_->room->map_instance->UnScale(hit_point);
|
||||
point.tar_pos.FromGlmVec3(hit_point);
|
||||
|
Loading…
x
Reference in New Issue
Block a user