pathfinder

package
v0.0.0-...-e6ef893 Latest Latest
Warning

This package is not in the latest version of its module.

Go to latest
Published: Dec 5, 2024 License: MIT Imports: 7 Imported by: 0

Documentation

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

This section is empty.

Types

type Cgo_ObsNavMesh

type Cgo_ObsNavMesh C.ObsNavMesh

func (*Cgo_ObsNavMesh) ObsAddAabbBox

func (mesh *Cgo_ObsNavMesh) ObsAddAabbBox(tag string, minPos, maxPos *protomsg.Vector3)

func (*Cgo_ObsNavMesh) ObsAddCylinder

func (mesh *Cgo_ObsNavMesh) ObsAddCylinder(tag string, spos *protomsg.Vector3, radius float32, height float32)

AddCyinderTO 增加动态阻挡

func (*Cgo_ObsNavMesh) ObsAddObbBox

func (mesh *Cgo_ObsNavMesh) ObsAddObbBox(tag string, centPos, halfPos *protomsg.Vector3, rotaY float32)

AddObbBox 增加OBB动态阻挡Box

func (*Cgo_ObsNavMesh) ObsRemoveAllTO

func (mesh *Cgo_ObsNavMesh) ObsRemoveAllTO()

func (*Cgo_ObsNavMesh) ObsRemoveTOByTag

func (mesh *Cgo_ObsNavMesh) ObsRemoveTOByTag(tag string)

RemoveTOByTag 删除动态阻挡

func (*Cgo_ObsNavMesh) ObsUpdateTO

func (mesh *Cgo_ObsNavMesh) ObsUpdateTO()

UpdateTO 更新临时阻挡信息

type Cgo_ObsPathFinder

type Cgo_ObsPathFinder C.ObsPathFinder

func (*Cgo_ObsPathFinder) CalcNavNear

func (finder *Cgo_ObsPathFinder) CalcNavNear(spos *protomsg.Vector3, count *int32) *C.float

获取导航附近的点

func (*Cgo_ObsPathFinder) CalcRaycast

func (finder *Cgo_ObsPathFinder) CalcRaycast(spos *protomsg.Vector3, epos *protomsg.Vector3, count *int32) *C.float

CalcRaycast 射线检测

func (*Cgo_ObsPathFinder) FindNavPath

func (finder *Cgo_ObsPathFinder) FindNavPath(spos *protomsg.Vector3, epos *protomsg.Vector3, count *int32) *C.float

查找路径

func (*Cgo_ObsPathFinder) FreeObsPath

func (finder *Cgo_ObsPathFinder) FreeObsPath()

type FinderObs

type FinderObs struct {
	Iskey bool //是否有Key,有Key的不能修改墙信息
	//地图的引用,释放的时候,只需要释放指针就好
	NavMesh *Cgo_ObsNavMesh
	// 寻路用对象,每个地图实例一个,释放的时候,需要delete
	Finder *Cgo_ObsPathFinder
}

func (*FinderObs) CheckWall

func (this *FinderObs) CheckWall(srcPos, dstPos protomsg.Vector3) (path []protomsg.Vector3, bHaveWall bool)

CheckWall 按照100单位步长检查墙 墙的定义点位高程超过500单位

func (*FinderObs) CreateObstacleCylinder

func (this *FinderObs) CreateObstacleCylinder(doorName string, centPos protomsg.Vector3, radius, height int32)

增加圆柱体阻挡

func (*FinderObs) CreateObstacleOBBBox

func (this *FinderObs) CreateObstacleOBBBox(doorName string, centPos, halfPos protomsg.Vector3, YawDegree int32)

动态阻挡相关 增加可旋转的Box阻挡

func (*FinderObs) Destroy

func (this *FinderObs) Destroy()

func (*FinderObs) FindPath

func (this *FinderObs) FindPath(stpos, edpos protomsg.Vector3) (path []protomsg.Vector3, result bool)

FindPath 提供外部寻路算法

参数:

params 起点终点
findtype 切换寻路类型

返回值:

path 路点,注意第一个点就是输入的起始点
result 是否寻路成功

func (*FinderObs) GetNear

func (this *FinderObs) GetNear(srcPos *protomsg.Vector3) (pos *protomsg.Vector3, result bool)

GetNear 获取某个点附近的合法位置 参数:

params 检查点 *protomsg.Vector3 类型

返回值:

pos 路点,注意第一个点就是输入的起始点
result 是否能成功

func (*FinderObs) MeshCheckRushPath

func (this *FinderObs) MeshCheckRushPath(srcPos, stpos protomsg.Vector3) protomsg.Vector3

func (*FinderObs) RaycastEx

func (this *FinderObs) RaycastEx(srcPos, dstPos protomsg.Vector3) (*protomsg.Vector3, bool)

Raycast 射线检测,是否撞到墙了 参数:

srcPos 起点
dstPos 终点

返回值:

pos 如果撞到墙了将会返回墙体位置,否则为空
result 是否碰到墙了,true 碰到墙 false 没有撞到墙

func (*FinderObs) RemoveAllObstacle

func (this *FinderObs) RemoveAllObstacle()

清理全部的门

func (*FinderObs) RemoveObstacle

func (this *FinderObs) RemoveObstacle(doorName string)

清理掉某个门

func (*FinderObs) UpdateObstacle

func (this *FinderObs) UpdateObstacle()

更新阻挡信息

type IPathFinder

type IPathFinder interface {

	// FindPath 提供外部寻路算法
	//
	// 参数:
	//    params 起点终点
	//    findtype 切换寻路类型
	//
	// 返回值:
	//    path 路点,注意第一个点就是输入的起始点
	//    result 是否寻路成功
	FindPath(stpos, edpos protomsg.Vector3) (path []protomsg.Vector3, result bool)

	// GetNear 获取某个点附近的合法位置
	// 参数:
	//    params 检查点 *linmath.Vector3 类型
	// 返回值:
	//    pos 路点,注意第一个点就是输入的起始点
	//    result 是否能成功
	GetNear(srcPos *protomsg.Vector3) (pos *protomsg.Vector3, result bool)

	// CheckWall 按照100单位步长检查墙
	// 墙的定义点位高程超过500单位
	CheckWall(srcPos, dstPos protomsg.Vector3) (path []protomsg.Vector3, bHaveWall bool)

	// Raycast 射线检测,是否撞到墙了
	// 参数:
	//    srcPos 起点
	//    dstPos 终点
	// 返回值:
	//    pos 如果撞到墙了将会返回墙体位置,否则为空
	//    result 是否碰到墙了,true 碰到墙 false 没有撞到墙
	RaycastEx(srcPos, dstPos protomsg.Vector3) (*protomsg.Vector3, bool)

	//动态阻挡相关
	// 增加可旋转的Box阻挡
	CreateObstacleOBBBox(doorName string, centPos, halfPos protomsg.Vector3, YawDegree int32)
	// 增加圆柱体阻挡
	CreateObstacleCylinder(doorName string, centPos protomsg.Vector3, radius, height int32)
	// 清理掉某个门
	RemoveObstacle(doorName string)
	// 清理全部的门
	RemoveAllObstacle()
	// 更新阻挡信息
	UpdateObstacle()

	MeshCheckRushPath(srcPos, stpos protomsg.Vector3) protomsg.Vector3

	Destroy()
}
type NavMeshMgr struct {
	// contains filtered or unexported fields
}

func GetMeshMgr

func GetMeshMgr() *NavMeshMgr
func (this *NavMeshMgr) GetFinder(filename, key string) (result *FinderObs)

静态地图 获取寻路对象

func (this *NavMeshMgr) GetNavMesh(filename, key string) (result *Cgo_ObsNavMesh)

那种有墙体的地图,需要通过这个生成出来后,然后添加墙体,等别人使用

type NavmeshParams struct {
	Start protomsg.Vector3
	End   protomsg.Vector3
}

func PackageFindParams

func PackageFindParams(srcPos, dstPos protomsg.Vector3) NavmeshParams

Jump to

Keyboard shortcuts

? : This menu
/ : Search site
f or F : Jump to
y or Y : Canonical URL