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