Plasma Engine  2.0
Loading...
Searching...
No Matches
JoltHitboxComponent.h
1#pragma once
2
3#include <Core/ResourceManager/ResourceHandle.h>
4#include <Core/World/Component.h>
5#include <Core/World/World.h>
6#include <JoltPlugin/JoltPluginDLL.h>
7
9
11
13
22class PL_JOLTPLUGIN_DLL plJoltHitboxComponent : public plComponent
23{
25
27 // plComponent
28
29public:
30 virtual void SerializeComponent(plWorldWriter& inout_stream) const override;
31 virtual void DeserializeComponent(plWorldReader& inout_stream) override;
32
33protected:
34 virtual void OnSimulationStarted() override;
35 virtual void OnDeactivated() override;
36
38 // plJoltHitboxComponent
39
40public:
43
45 plUInt32 GetObjectFilterID() const { return m_uiObjectFilterID; } // [ scriptable ]
46
48 bool m_bQueryShapeOnly = true; // [ property ]
49
51 plTime m_UpdateThreshold; // [ property ]
52
54 void OnAnimationPoseUpdated(plMsgAnimationPoseUpdated& ref_msg); // [ msg handler ]
55
61 void RecreatePhysicsShapes(); // [ scriptable ]
62
63protected:
64 void CreatePhysicsShapes(const plSkeletonResourceHandle& hSkeleton);
65 void DestroyPhysicsShapes();
66
67 struct Shape
68 {
69 plUInt16 m_uiAttachedToBone = 0xFFFF;
70 plVec3 m_vOffsetPos;
71 plQuat m_qOffsetRot;
72
73 plGameObjectHandle m_hActorObject;
74 };
75
76 plUInt32 m_uiObjectFilterID = plInvalidIndex;
77 plTime m_LastUpdate;
78 plDynamicArray<Shape> m_Shapes;
79};
Base class of all component types.
Definition Component.h:25
virtual void SerializeComponent(plWorldWriter &inout_stream) const
Override this to save the current state of the component to the given stream.
Definition Component.cpp:54
virtual void OnDeactivated()
This method is called when the component gets deactivated.
Definition Component.cpp:142
virtual void OnSimulationStarted()
This method is called once for active components, at the start of the next world update,...
Definition Component.cpp:144
virtual void DeserializeComponent(plWorldReader &inout_stream)
Override this to load the current state of the component from the given stream.
Definition Component.cpp:58
Definition ComponentManager.h:88
Definition DynamicArray.h:81
Adds physics shapes to an animated character for hit detection.
Definition JoltHitboxComponent.h:23
plTime m_UpdateThreshold
At which interval to update the hitbox transforms. Set to zero for full updates every frame.
Definition JoltHitboxComponent.h:51
plUInt32 GetObjectFilterID() const
The same object filter ID is assigned to all hit shapes.
Definition JoltHitboxComponent.h:45
Reads a world description from a stream. Allows to instantiate that world multiple times in different...
Definition WorldReader.h:47
Stores an entire plWorld in a stream.
Definition WorldWriter.h:13
A handle to a game object.
Definition Declarations.h:76
Definition JoltHitboxComponent.h:68
Used by components that skin a mesh to inform children whenever a new pose has been computed.
Definition Declarations.h:68
The time class encapsulates a double value storing the time in seconds.
Definition Time.h:12