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/BsHingeJoint.h"
7#include "Components/BsCJoint.h"
8
9namespace bs
10{
11 /** @addtogroup Components-Core
12 * @{
13 */
14
15 /**
16 * @copydoc HingeJoint
17 *
18 * @note Wraps HingeJoint as a Component.
19 */
20 class BS_CORE_EXPORT BS_SCRIPT_EXPORT(m:Physics,n:HingeJoint) CHingeJoint : public CJoint
21 {
22 public:
23 CHingeJoint(const HSceneObject& parent);
24
25 /** @copydoc HingeJoint::getAngle */
26 BS_SCRIPT_EXPORT(n:Angle,pr:getter)
27 Radian getAngle() const;
28
29 /** @copydoc HingeJoint::getSpeed */
30 BS_SCRIPT_EXPORT(n:Speed,pr:getter)
31 float getSpeed() const;
32
33 /** @copydoc HingeJoint::getLimit */
34 BS_SCRIPT_EXPORT(n:Limit,pr:getter)
35 LimitAngularRange getLimit() const;
36
37 /** @copydoc HingeJoint::setLimit */
38 BS_SCRIPT_EXPORT(n:Limit,pr:setter)
39 void setLimit(const LimitAngularRange& limit);
40
41 /** @copydoc HingeJoint::getDrive */
42 BS_SCRIPT_EXPORT(n:Drive,pr:getter)
43 HingeJointDrive getDrive() const;
44
45 /** @copydoc HingeJoint::setDrive */
46 BS_SCRIPT_EXPORT(n:Drive,pr:setter)
47 void setDrive(const HingeJointDrive& drive);
48
49 /** @copydoc HingeJoint::setFlag */
50 BS_SCRIPT_EXPORT(n:SetFlag)
51 void setFlag(HingeJointFlag flag, bool enabled);
52
53 /** @copydoc HingeJoint::hasFlag */
54 BS_SCRIPT_EXPORT(n:HasFlag)
55 bool hasFlag(HingeJointFlag flag) const;
56
57 /** @name Internal
58 * @{
59 */
60
61 /** Returns the hinge joint that this component wraps. */
62 HingeJoint* _getInternal() const { return static_cast<HingeJoint*>(mInternal.get()); }
63
64 /** @} */
65
66 /************************************************************************/
67 /* COMPONENT OVERRIDES */
68 /************************************************************************/
69 protected:
70 friend class SceneObject;
71
72 /** @copydoc CJoint::createInternal */
73 SPtr<Joint> createInternal() override;
74
75 HINGE_JOINT_DESC mDesc;
76
77 /************************************************************************/
78 /* RTTI */
79 /************************************************************************/
80 public:
81 friend class CHingeJointRTTI;
82 static RTTITypeBase* getRTTIStatic();
83 RTTITypeBase* getRTTI() const override;
84
85 protected:
86 CHingeJoint(); // Serialization only
87 };
88
89 /** @} */
90}