From 412d53a1f7e667b0d10144a0d730665259ed5019 Mon Sep 17 00:00:00 2001 From: sippeangelo Date: Sun, 6 Apr 2014 20:55:54 +0200 Subject: [PATCH] Physics constraint components --- src/Components/BallSocketConstraint.h | 19 +++++++++++++++ src/Components/HingeConstraint.h | 35 +++++++++++++++++++++++++++ src/Components/SliderConstraint.h | 16 ++++++++++++ 3 files changed, 70 insertions(+) create mode 100755 src/Components/BallSocketConstraint.h create mode 100755 src/Components/HingeConstraint.h create mode 100755 src/Components/SliderConstraint.h diff --git a/src/Components/BallSocketConstraint.h b/src/Components/BallSocketConstraint.h new file mode 100755 index 0000000..e24ae37 --- /dev/null +++ b/src/Components/BallSocketConstraint.h @@ -0,0 +1,19 @@ +#ifndef Components_BallSocketConstraint_h__ +#define Components_BallSocketConstraint_h__ + +#include "Component.h" + +namespace Components +{ + // http://bulletphysics.org/mediawiki-1.5.8/index.php/Constraints + struct BallSocketConstraint : Component + { + // Create constraint between these entities + EntityID EntityA; + EntityID EntityB; + // The pivot point in local coordinates + glm::vec3 PivotA; + glm::vec3 PivotB; + }; +} +#endif // Components_BallSocketConstraint_h__ \ No newline at end of file diff --git a/src/Components/HingeConstraint.h b/src/Components/HingeConstraint.h new file mode 100755 index 0000000..854a0d3 --- /dev/null +++ b/src/Components/HingeConstraint.h @@ -0,0 +1,35 @@ +#ifndef Components_HingeConstraint_h__ +#define Components_HingeConstraint_h__ + +#include "Component.h" + +namespace Components +{ + // http://bulletphysics.org/mediawiki-1.5.8/index.php/Constraints + struct HingeConstraint : Component + { + // Create constraint between these entities + EntityID EntityA; + EntityID EntityB; + // The pivot point in local coordinates + glm::vec3 PivotA; + glm::vec3 PivotB; + // The axis to rotate around + glm::vec3 AxisA; + glm::vec3 AxisB; + + /* + void setLimit(btScalar low, + btScalar high, + btScalar softness = 0.9f, + btScalar_biasFactor = 0.3f, + btScalar relaxationFactor = 1.0f) + */ + float LowLimit; + float HighLimit; + float Softness = 0.9f; + float BiasFactor = 0.3f; + float RelaxationFactor = 1.0f; + }; +} +#endif // Components_HingeConstraint_h__ \ No newline at end of file diff --git a/src/Components/SliderConstraint.h b/src/Components/SliderConstraint.h new file mode 100755 index 0000000..5c147df --- /dev/null +++ b/src/Components/SliderConstraint.h @@ -0,0 +1,16 @@ +#ifndef Components_SliderConstraint_h__ +#define Components_SliderConstraint_h__ + +#include "Component.h" + +namespace Components +{ + // http://bulletphysics.org/mediawiki-1.5.8/index.php/Constraints + struct SliderConstraint : Component + { + // Create constraint between these entities + EntityID EntityA; + EntityID EntityB; + }; +} +#endif // Components_SliderConstraint_h__ \ No newline at end of file