1
This commit is contained in:
parent
aca6f74bbc
commit
a4b3011448
@ -2,6 +2,8 @@
|
||||
|
||||
#include "movehelper.h"
|
||||
#include "moveableentity.h"
|
||||
#include "room.h"
|
||||
#include "mapinstance.h"
|
||||
|
||||
MoveHelper::MoveHelper(class MoveableEntity* owner)
|
||||
{
|
||||
@ -14,32 +16,25 @@ bool MoveHelper::GetMovePosition(glm::vec3& out_pos)
|
||||
}
|
||||
|
||||
void MoveHelper::CalcTargetPos(float distance)
|
||||
{
|
||||
|
||||
}
|
||||
|
||||
#if 0
|
||||
void MoveableEntity::CalcTargetPos(float distance)
|
||||
{
|
||||
glm::vec3 start;
|
||||
glm::vec3 end;
|
||||
glm::vec3 hit_point;
|
||||
|
||||
start.x = GetPos().x / 10.0f;
|
||||
start.z = GetPos().y / 10.0f;
|
||||
start.x = owner_->GetPos().x / 10.0f;
|
||||
start.z = owner_->GetPos().y / 10.0f;
|
||||
|
||||
a8::Vec2 target_pos2d = GetPos() + GetMoveDir() * distance;
|
||||
a8::Vec2 target_pos2d = owner_->GetPos() + owner_->GetMoveDir() * distance;
|
||||
end.x = target_pos2d.x / 10.0f;
|
||||
end.z = target_pos2d.y / 10.0f;
|
||||
|
||||
last_pos_.x = GetPos().x;
|
||||
last_pos_.z = GetPos().y;
|
||||
//last_pos_.x = GetPos().x;
|
||||
//last_pos_.z = GetPos().y;
|
||||
|
||||
int ret = room->map_instance->Raycast(0, start, end, hit_point);
|
||||
int ret = owner_->room->map_instance->Raycast(0, start, end, hit_point);
|
||||
if (ret > 1) {
|
||||
SetTargetPos(hit_point * 10.0f);
|
||||
//SetTargetPos(hit_point * 10.0f);
|
||||
} else {
|
||||
SetTargetPos(end * 10.0f);
|
||||
//SetTargetPos(end * 10.0f);
|
||||
}
|
||||
}
|
||||
#endif
|
||||
|
Loading…
x
Reference in New Issue
Block a user