Astar 父级,getpath [英] Astar parent, getpath

查看:20
本文介绍了Astar 父级,getpath的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

有我的 astar 算法,但我不知道如何获得父级并从目的地获得快速路线.

there is my astar algorithm, But I don't know how to get parent and get a quick route from the Destination.

Node script methods
getPos()  (Vector2)
Parent  (Node)

Node n = ?.Parent;
while(n != null)
{
    path.add(n.getPos());
    n = n.Parent;
}

推荐答案

您必须将当前"设置为相邻节点的父节点.然后如果找到目的地,你就按照父条目的路径,这就是路径

You have to set "current" as parent to the adjacent nodes. Then if the destination is found, you follow the path of the parent entries, this is the path

我也看不到成本"实现......

Also i can´t see a "cost" implementation ...

这篇关于Astar 父级,getpath的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

查看全文
登录 关闭
扫码关注1秒登录
发送“验证码”获取 | 15天全站免登陆