AM
Size: a a a
AM
S
S
S
AM
AM
S
S
S
A
A
S
S
S
AK
d
ЕЕ
AK
void IsometricDemoScene::find_path(Vec2 target_point)
{
//Vec2 start_point = _map->convertToNodeSpace(_character_sprite->getPosition());
Vec2 start_point = _map->convertToWorldSpace(_character_sprite->getPosition());
Vec2 point2 = target_point;
log("Start: %fx%f, end: %fx%f", start_point.x, start_point.y, target_point.x, target_point.y);
PhysicsRayCastCallbackFunc func = [&point2](PhysicsWorld& /*world*/, const PhysicsRayCastInfo& info, void* /*data*/)->bool
{
point2 = info.contact;
return false;
};
_physicsWorld->rayCast(func, start_point, target_point, &point2);
auto node = DrawNode::create();
if (point2 != target_point) {
node->drawDot(point2, 1, Color4F(1.0f, 1.0f, 1.0f, 1.0f));
}
_map->addChild(node);
}
AK
AK