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/BsSphereCollider.h"
7#include "Components/BsCCollider.h"
8
9namespace bs
10{
11 /** @addtogroup Components-Core
12 * @{
13 */
14
15 /**
16 * @copydoc SphereCollider
17 *
18 * @note Wraps SphereCollider as a Component.
19 */
20 class BS_CORE_EXPORT BS_SCRIPT_EXPORT(m:Physics,n:SphereCollider) CSphereCollider : public CCollider
21 {
22 public:
23 CSphereCollider(const HSceneObject& parent, float radius = 1.0f);
24
25 /** @copydoc SphereCollider::setRadius */
26 BS_SCRIPT_EXPORT(n:Radius,pr:setter)
27 void setRadius(float radius);
28
29 /** @copydoc SphereCollider::getRadius */
30 BS_SCRIPT_EXPORT(n:Radius,pr:getter)
31 float getRadius() const { return mRadius; }
32
33 /** Determines position of the sphere shape, relative to the component's scene object. */
34 BS_SCRIPT_EXPORT(n:Center,pr:setter)
35 void setCenter(const Vector3& center);
36
37 /** @copydoc setCenter() */
38 BS_SCRIPT_EXPORT(n:Center,pr:getter)
39 Vector3 getCenter() const { return mLocalPosition; }
40
41 /** @name Internal
42 * @{
43 */
44
45 /** Returns the sphere collider that this component wraps. */
46 SphereCollider* _getInternal() const { return static_cast<SphereCollider*>(mInternal.get()); }
47
48 /** @} */
49
50 /************************************************************************/
51 /* COMPONENT OVERRIDES */
52 /************************************************************************/
53 protected:
54 friend class SceneObject;
55
56 /** @copydoc CCollider::createInternal */
57 SPtr<Collider> createInternal() override;
58
59 protected:
60 float mRadius = 1.0f;
61
62 /************************************************************************/
63 /* RTTI */
64 /************************************************************************/
65 public:
66 friend class CSphereColliderRTTI;
67 static RTTITypeBase* getRTTIStatic();
68 RTTITypeBase* getRTTI() const override;
69
70 protected:
71 CSphereCollider(); // Serialization only
72 };
73
74 /** @} */
75}