1//************************************ bs::framework - Copyright 2018 Marko Pintera **************************************//
2//*********** Licensed under the MIT license. See LICENSE.md for full terms. This notice is not to be removed. ***********//
3#pragma once
4
5#include "BsCorePrerequisites.h"
6#include "Physics/BsMeshCollider.h"
7#include "Components/BsCCollider.h"
8
9namespace bs
10{
11 /** @addtogroup Components-Core
12 * @{
13 */
14
15 /**
16 * @copydoc MeshCollider
17 *
18 * @note Wraps MeshCollider as a Component.
19 */
20 class BS_CORE_EXPORT BS_SCRIPT_EXPORT(m:Physics,n:MeshCollider) CMeshCollider : public CCollider
21 {
22 public:
23 CMeshCollider(const HSceneObject& parent);
24
25 /** @copydoc MeshCollider::setMesh */
26 BS_SCRIPT_EXPORT(n:Mesh,pr:setter)
27 void setMesh(const HPhysicsMesh& mesh);
28
29 /** @copydoc MeshCollider::getMesh */
30 BS_SCRIPT_EXPORT(n:Mesh,pr:getter)
31 HPhysicsMesh getMesh() const { return mMesh; }
32
33 /** @name Internal
34 * @{
35 */
36
37 /** Returns the mesh collider that this component wraps. */
38 MeshCollider* _getInternal() const { return static_cast<MeshCollider*>(mInternal.get()); }
39
40 /** @} */
41
42 /************************************************************************/
43 /* COMPONENT OVERRIDES */
44 /************************************************************************/
45 protected:
46 friend class SceneObject;
47
48 /** @copydoc CCollider::createInternal */
49 SPtr<Collider> createInternal() override;
50
51 /** @copydoc CCollider::isValidParent */
52 bool isValidParent(const HRigidbody& parent) const override;
53
54 protected:
55 HPhysicsMesh mMesh;
56
57 /************************************************************************/
58 /* RTTI */
59 /************************************************************************/
60 public:
61 friend class CMeshColliderRTTI;
62 static RTTITypeBase* getRTTIStatic();
63 RTTITypeBase* getRTTI() const override;
64
65 protected:
66 CMeshCollider(); // Serialization only
67 };
68
69 /** @} */
70}