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

查看:75
本文介绍了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天全站免登陆