public void SetBuildingParams(float agentHeight, float agentRadius, float agentMaxClimb, float agentMaxSlope, float cellSize, float cellHeight, float regionMinSize, float regionMergeSize, float edgeMaxLen, float edgeMaxError, float vertsPerPoly, float detailSampleDist, float detailSampleMaxError, int partitionType, float tileSize) { RecastDll.SetBuildParams(this.recastPtr, agentHeight, agentRadius, agentMaxClimb, agentMaxSlope, cellSize, cellHeight, regionMinSize, regionMergeSize, edgeMaxLen, edgeMaxError, vertsPerPoly, detailSampleDist, detailSampleMaxError, partitionType, tileSize); }
public bool FindRandomPoint(ref Vector3 resultPoint) { NavimeshStatus status = (NavimeshStatus)RecastDll.FindRandomPoint(this.recastPtr, this.resultPos); if (this.IsSuccessStatus(status)) { resultPoint.Set(this.resultPos[0], this.resultPos[1], this.resultPos[2]); return(true); } return(false); }
/// <summary> /// 添加圆柱形障碍 /// </summary> /// <param name="pos">y轴要贴近地面</param> public IntPtr AddCylinderObstacle(Vector3 pos, float radius, float height) { this.Vector3ToArray(ref pos, this.startPos); IntPtr obstaclePtr; if (RecastDll.AddCylinderObstacle(this.recastPtr, this.startPos, radius, height, out obstaclePtr)) { return(obstaclePtr); } return(IntPtr.Zero); }
public bool FindRandomPointAroundCircle(ref Vector3 center, float radius, ref Vector3 resultPoint) { this.Vector3ToArray(ref center, this.startPos); NavimeshStatus status = (NavimeshStatus)RecastDll.FindRandomPointAroundCircle(this.recastPtr, this.startPos, radius, this.resultPos); if (this.IsSuccessStatus(status)) { resultPoint.Set(this.resultPos[0], this.resultPos[1], this.resultPos[2]); return(true); } return(false); }
/// <summary> /// 添加矩形障碍 /// </summary> public IntPtr AddBoxObstacle(Vector3 bMin, Vector3 bMax) { this.Vector3ToArray(ref bMin, this.startPos); this.Vector3ToArray(ref bMax, this.endPos); IntPtr obstaclePtr; if (RecastDll.AddBoxObstacle(this.recastPtr, this.startPos, this.endPos, out obstaclePtr)) { return(obstaclePtr); } return(IntPtr.Zero); }
public bool Raycast(ref Vector3 startPoint, ref Vector3 endPoint, ref Vector3 hitPoint) { this.Vector3ToArray(ref startPoint, this.startPos); this.Vector3ToArray(ref endPoint, this.endPos); NavimeshStatus status = (NavimeshStatus)RecastDll.Raycast(this.recastPtr, this.startPos, this.endPos, this.resultPos); if (this.IsSuccessStatus(status)) { hitPoint.Set(this.resultPos[0], this.resultPos[1], this.resultPos[2]); return(true); } return(false); }
public ConvexVolumeData[] GetVolumeDatas() { int length = RecastDll.GetConvexCount(this.recastPtr); var array = new ConvexVolumeData[length]; var size = Marshal.SizeOf(typeof(ConvexVolumeData)) * length; var ptr = Marshal.AllocHGlobal(size); RecastDll.GetConvexArray(this.recastPtr, ptr); for (var i = 0; i < length; i++) { var p = new IntPtr(ptr.ToInt64() + Marshal.SizeOf(typeof(ConvexVolumeData)) * i); array[i] = (ConvexVolumeData)Marshal.PtrToStructure(p, typeof(ConvexVolumeData)); } Marshal.FreeHGlobal(ptr); // 释放内存 return(array); }
/// <summary> /// 路径点少,无平滑 /// </summary> public bool FindStraightPath(Vector3 startPos, Vector3 endPos, List <Vector3> path) { this.Vector3ToArray(ref startPos, this.startPos); this.Vector3ToArray(ref endPos, this.endPos); NavimeshStatus status = (NavimeshStatus)RecastDll.FindStraightPath(this.recastPtr, this.startPos, this.endPos, this.straightPath, ref this.straigntCount); if (this.IsSuccessStatus(status)) { path.Clear(); int count = this.straigntCount * 3; Debug.Assert(this.straightPath.Length >= count); for (int i = 0; i < count; i += 3) { Vector3 point = new Vector3(this.straightPath[i], this.straightPath[i + 1], this.straightPath[i + 2]); path.Add(point); } return(true); } return(false); }
public bool DeleteConvexPolygon(Vector3 point) { //point.x = -point.x; this.Vector3ToArray(ref point, this.startPos); return(RecastDll.DeleteConvexPolygon(this.recastPtr, this.startPos)); }
public void RemoveTile(Vector3 minPoint, Vector3 maxPoint) { this.Vector3ToArray(ref minPoint, this.startPos); this.Vector3ToArray(ref maxPoint, this.endPos); RecastDll.RemoveTile(this.recastPtr, this.startPos, this.endPos); }
public void Update(float deltaTime) { RecastDll.Update(this.recastPtr, deltaTime); }
public void SetFilterFlag(PolyFlags flag, bool isIncluded) { RecastDll.SetFilterFlag(this.recastPtr, (int)flag, isIncluded); }
public void SetAreaCost(PolyAreas area, float cost) { RecastDll.SetAreaCost(this.recastPtr, (int)area, cost); }
static RecastBase() { RecastDll.SetEnvLog(Log); }
public bool LoadMeshBin(string binPath) { return(RecastDll.LoadMeshBin(this.recastPtr, binPath)); }
public bool LoadGeometry(string inObjPath) { return(RecastDll.LoadMeshGeometry(this.recastPtr, inObjPath)); }
public void RemoveAllObstacles() { RecastDll.RemoveAllObstacles(this.recastPtr); }
public void Build(string outBinPath) { RecastDll.BuildBinary(this.recastPtr, outBinPath); }
public bool MakeConvexPolygon(PolyAreas areaType) { return(RecastDll.MakeConvexPolygon(this.recastPtr, (int)areaType)); }
public void AddConvexPoint(Vector3 point) { //point.x = -point.x; this.Vector3ToArray(ref point, this.startPos); RecastDll.AddConvexPoint(this.recastPtr, this.startPos); }
public bool RemoveObstacle(IntPtr obstaclePtr) { return(RecastDll.RemoveObstacle(this.recastPtr, obstaclePtr)); }
public void GetBuildSettings(out BuildSettings settings) { RecastDll.GetBuildSettings(this.recastPtr, out settings); }
public TileCacheRecast() { this.recastPtr = RecastDll.CreateTileCacheRecast(); }
public virtual void Release() { RecastDll.Release(this.recastPtr); }