10 #ifndef Navigation_BoxObstacle_H
11 #define Navigation_BoxObstacle_H
25 class DatabaseBinding;
49 BoxObstacleUp_Minus_X,
51 BoxObstacleUp_Minus_Y,
75 m_localHalfExtents.
Set(0.0f, 0.0f, 0.0f);
76 m_startPosition.
Set(0.0f, 0.0f, 0.0f);
105 Vec3f m_localHalfExtents;
106 Vec3f m_startPosition;
138 virtual const char* GetTypeName()
const {
return "BoxObstacle"; }
204 const Vec3f& GetLocalCenter()
const;
205 const Vec3f& GetLocalHalfExtents()
const;
208 const Vec3f& GetLinearVelocity()
const;
209 const Vec3f& GetAngularVelocity()
const;
213 const DynamicNavTag& GetNavTag()
const;
214 KyUInt32 GetSpatializedCylinderCount()
const;
217 TagVolume::IntegrationStatus GetTagVolumeIntegrationStatus()
const;
235 void ComputeSampledPoints();
240 void ComputeSampledPoints_2D(
const Vec3f& baseCenter,
const Vec3f& axis0,
const Vec3f& axis1,
246 void ComputeSampledPoints_1D(
const Vec3f& baseCenter,
const Vec3f& axis,
251 void ComputePositionAndVelocity(
const Vec3f& localPosition,
Vec3f& newPosition,
Vec3f& newVelocity);
255 virtual void DoSendVisualDebug(
VisualDebugServer& visualDebugServer, VisualDebugSendChangeEvent changeEvent);
260 void UpdateSpatialization();
268 void OnTagVolumeIntegration();
278 KyUInt32 GetSampledSpatializedCylinderCount();
286 Ptr<DatabaseBinding> m_databaseBinding;
288 DynamicNavTag m_navTag;
291 Vec3f m_localHalfExtents;
297 bool m_doesTriggerTagVolume;
316 Vec3f* m_sampledSpatializedCylinderLocalPositions;
317 KyUInt32 m_sampledSpatializedCylinderCount;
320 KY_INLINE
const DynamicNavTag& BoxObstacle::GetNavTag()
const {
return m_navTag; }
321 KY_INLINE
const Vec3f& BoxObstacle::GetLocalCenter()
const {
return m_localCenter; }
322 KY_INLINE
const Vec3f& BoxObstacle::GetLocalHalfExtents()
const {
return m_localHalfExtents; }
326 KY_INLINE
const TagVolume* BoxObstacle::GetTagVolume()
const {
return m_tagVolumeTrigger.GetTagVolume(); }
327 KY_INLINE TagVolume::IntegrationStatus BoxObstacle::GetTagVolumeIntegrationStatus()
const {
return m_tagVolumeTrigger.GetIntegrationStatus(); }
328 KY_INLINE
const DatabaseBinding* BoxObstacle::GetDatabaseBinding()
const {
return m_databaseBinding; }
330 KY_INLINE
KyUInt32 BoxObstacle::GetSpatializedCylinderCount()
const
334 KY_INLINE
const SpatializedCylinder& BoxObstacle::GetSpatializedCylinder(
KyUInt32 index)
const
336 return (GetRotationMode() ==
BoxObstacleRotation_Yaw) ? m_sampledSpatializedCylinders[index] : m_centralSpatializedCylinder;
339 KY_INLINE
const Vec3f& BoxObstacle::GetLinearVelocity()
const {
return m_linearVelocity; }
341 KY_INLINE
const Transform& BoxObstacle::GetTransform()
const {
return m_transform; }
343 KY_INLINE SpatializedCylinder& BoxObstacle::GetCentralSpatializedCylinder() {
return m_centralSpatializedCylinder; }
344 KY_INLINE
KyUInt32 BoxObstacle::GetSampledSpatializedCylinderCount() {
return m_sampledSpatializedCylinderCount; }
346 KY_INLINE
TagVolume* BoxObstacle::GetTagVolume() {
return m_tagVolumeTrigger.GetTagVolume(); }
350 #endif // Navigation_BoxObstacle_H
void Clear()
Prepares this instance for destruction and / or reuse: sets all members to their default values and c...
BoxObstacleRotationMode
Enumerates the possible controls for how a BoxObstacle should be internally represented.
Definition: boxobstacle.h:30
Class used to provide TagVolume initialization parameters.
Definition: tagvolume.h:36
void SetTransform(const Transform &transform)
The transform of the box.
static const char * GetRotationModeDescription(BoxObstacleRotationMode rotationMode)
Returns a short description of the rotation mode for visual debug.
Used for all obstacles which are freely rotating (for example, concrete blocs just after the explosio...
Definition: boxobstacle.h:40
Vec3f m_localCenter
Defines the local AABBox center relatively to rotation axis.
Definition: boxobstacle.h:113
void Set(KyFloat32 _x, KyFloat32 _y, KyFloat32 _z)
Sets the coordinates.
Definition: vec3f.h:52
void SetDefaults()
Sets all members to their default value.
Definition: boxobstacle.h:73
void SetAngularVelocity(const Vec3f &angularVelocity)
The rotational speed as rotation vector.
void AddToWorld()
Adds the BoxObstacle to the World.
Vec3f m_angularVelocity
Stores the rotational speed as rotation vector expressed in World coordinate system.
Definition: boxobstacle.h:345
#define KY_NULL
Null value.
Definition: types.h:247
BoxObstacleUpAxis
Enumerates the possible up-axis definition for a BoxObstacle.
Definition: boxobstacle.h:46
#define KY_CLASS_WITHOUT_COPY(ClassName)
Define to forbid copy constructor and copy assignment.
Definition: types.h:387
This class is a runtime container for Gameware Navigation WorldElements such as NavData, Bots, BoxObstacles, TagVolumes...
Definition: world.h:54
World * m_world
Mandatory: you must provide a World when calling BoxObstacle::Init.
Definition: boxobstacle.h:95
This class represents runtime-defined volumes with customized NavTag.
Definition: tagvolume.h:108
Vec3f m_linearVelocity
The linear velocity, expressed in World coordinate system, at the local transform center of the box...
Definition: boxobstacle.h:340
DynamicNavTag m_navTag
This DynamicNavTag will be used to set up the TagVolume NavTag when the BoxObstacle will trigger it...
Definition: boxobstacle.h:104
Used for obstacles that are moving mainly horizontally (such as cars, doors, etc.).
Definition: boxobstacle.h:35
TagVolumeTrigger is dedicated to TagVolume creation / removal management.
Definition: tagvolumetrigger.h:25
DatabaseBinding is a collection of the databases to be used for world elements spatialization.
Definition: databasebinding.h:24
WorldElementType
Enumerates the WorldElement types.
Definition: worldelementtype.h:15
void Init(const BoxObstacleInitConfig &initConfig)
Sets m_world and allocates memory depending on m_databaseBinding; it does not add the obstacle to the...
Base internal class used to represent elements that can be added to a World, such as instances of Dat...
Definition: worldelement.h:45
Definition: gamekitcrowddispersion.h:20
Class used to provide BoxObstacle initialization parameters.
Definition: boxobstacle.h:58
void SetRotationMode(BoxObstacleRotationMode mode)
Sets the next rotation mode used to update this BoxObstacle.
void RemoveFromWorld()
Removes the BoxObstacle from the World.
bool DoesTriggerTagVolume() const
Returns whether the TriggerTagVolume flag is raised or not; not if the BoxObstacle has actually trigg...
Definition: boxobstacle.h:366
#define KY_DEFINE_NEW_DELETE_OPERATORS(MemStat)
This macro defines new and delete operators.
Definition: memory.h:137
The VisualDebugServer manages the sending of data to clients.
Definition: visualdebugserver.h:254
BoxObstacleUpAxis m_upAxis
Used only for BoxObstacles that are yaw-rotating.
Definition: boxobstacle.h:124
Internal representation of world elements, using a vertical cylinder shape.
Definition: spatializedcylinder.h:56
Ptr< DatabaseBinding > m_databaseBinding
Defines the Databases in which the BoxObstacle will be spatialized.
Definition: boxobstacle.h:100
unsigned int KyUInt32
Type used internally to represent an unsigned 32-bit integer.
Definition: types.h:36
void SetLinearVelocity(const Vec3f &linearVelocity)
The linear velocity at the local transform center of the box.
Each instance of the BoxObstacle class represents a dynamic, physical object in your game engine that...
Definition: boxobstacle.h:139
void SetDoesTriggerTagVolume(bool triggerTagVolume)
This information is copied and applied in the next World::Update.
float KyFloat32
Type used internally to represent a 32-bit floating-point number.
Definition: types.h:43
This class defines a three-dimensional vector whose coordinates are stored using floating-point numbe...
Definition: vec3f.h:23