8 #ifndef Navigation_CollisionWorld_H
9 #define Navigation_CollisionWorld_H
23 Collection<Ptr<CollisionData> > m_colDatas;
32 class CollisionWorld :
public RefCountBaseV<CollisionWorld, MemStat_WorldFwk>
36 CollisionWorld() : m_cellSize(100.f), m_invCellSize(1.f / m_cellSize), m_bufferOfColCellPosInfo(
KY_NULL), m_sizeOfCellBuffer(0) {}
39 void RemoveAllCollisionData();
42 void SetCollisionInterface(Ptr<ICollisionInterface> visInterface) { m_collisionInterface = visInterface; }
44 void AddCollisionData(Ptr<CollisionData> colData);
45 void RemoveCollisionData(Ptr<CollisionData> colData);
47 CollisionRayCastResult RayCast(
const Vec3f& a,
const Vec3f& b)
const;
49 bool IsWorldEmpty()
const {
return m_colData.GetCount() == 0; }
52 void GetIntersectingHeightFields(
const Vec3f& a,
const Vec3f& b, KyArray<CollisionData*>& results)
const;
53 void EnlargeGrid(
const CellBox& oldCellBox);
55 KyResult GetStartCellFromRay(
const Vec3f& a,
const Vec3f& b,
CellPos& startCellPos)
const;
57 KY_INLINE
CellPos GetCellPosFromVec2f_Floor(
const Vec2f& pos)
const
62 KY_INLINE
CellPos GetCellPosFromVec2f_Ceil(
const Vec2f& pos)
const
67 KY_INLINE
CellPos GetCellPosFromVec2f(
const Vec2f& pos)
const
72 KY_INLINE
CellBox GetCellBoxFromBox2f(
const Box2f& box2F)
const
74 const CellPos cellPosMin = GetCellPosFromVec2f_Floor(box2F.m_min);
75 const CellPos cellPosMax = GetCellPosFromVec2f_Ceil(box2F.m_max);
76 return CellBox(cellPosMin, cellPosMax);
79 KY_INLINE Vec2f GetPosFromCellPos(
const CellPos& cellPos)
const
81 return Vec2f(cellPos.x * m_cellSize, cellPos.y * m_cellSize);
84 KY_INLINE Box2f GetAABB2D()
const
86 return Box2f(GetPosFromCellPos(m_cellBox.m_min), GetPosFromCellPos(m_cellBox.m_max));
89 TrackedCollection<Ptr<CollisionData>, MemStat_WorldFwk> m_colData;
90 Ptr<ICollisionInterface> m_collisionInterface;
95 ColCellPosInfo* m_bufferOfColCellPosInfo;
101 #endif // Navigation_CollisionWorld_H
KyInt32 KyResult
Defines a type that can be returned by methods or functions in the Gameware Navigation SDK to indicat...
Definition: types.h:254
Box2i CellBox
A type that represents a bounding box around cells in a 2D grid.
Definition: navmeshtypes.h:34
Vec2i CellPos
A type that represents the position of a cell within a 2D grid.
Definition: navmeshtypes.h:33
int KyInt32
Type used internally to represent a 32-bit integer.
Definition: types.h:35
#define KY_NULL
Null value.
Definition: types.h:247
#define KY_CLASS_WITHOUT_COPY(ClassName)
Define to forbid copy constructor and copy assignment.
Definition: types.h:387
Definition: gamekitcrowddispersion.h:20
unsigned int KyUInt32
Type used internally to represent an unsigned 32-bit integer.
Definition: types.h:36
This class is a runtime container for all CollisionData that represents the world.
Definition: collisionworld.h:36
float KyFloat32
Type used internally to represent a 32-bit floating-point number.
Definition: types.h:43