45 #ifndef __CU_CAPSULE_OBSTACLE_H__
46 #define __CU_CAPSULE_OBSTACLE_H__
48 #include <Box2D/Collision/Shapes/b2PolygonShape.h>
49 #include <Box2D/Collision/Shapes/b2CircleShape.h>
50 #include <Box2D/Collision/b2Collision.h>
51 #include "CUSimpleObstacle.h"
56 #pragma mark Capsule Obstacle
114 #pragma mark Scene Graph Methods
136 #pragma mark Constructors
145 _core(nullptr), _cap1(nullptr), _cap2(nullptr), _seamEpsilon(0.0f) { }
157 CUAssertLog(_core ==
nullptr,
"You must deactive physics before deleting an object");
220 #pragma mark Static Constructors
226 static std::shared_ptr<CapsuleObstacle>
alloc() {
227 std::shared_ptr<CapsuleObstacle> result = std::make_shared<CapsuleObstacle>();
228 return (result->init() ? result :
nullptr);
243 static std::shared_ptr<CapsuleObstacle>
alloc(
const Vec2& pos) {
244 std::shared_ptr<CapsuleObstacle> result = std::make_shared<CapsuleObstacle>();
245 return (result->init(pos) ? result :
nullptr);
265 static std::shared_ptr<CapsuleObstacle>
alloc(
const Vec2& pos,
const Size& size) {
266 std::shared_ptr<CapsuleObstacle> result = std::make_shared<CapsuleObstacle>();
267 return (result->init(pos,size) ? result :
nullptr);
289 std::shared_ptr<CapsuleObstacle> result = std::make_shared<CapsuleObstacle>();
290 return (result->init(pos,size,orient) ? result :
nullptr);
295 #pragma mark Dimensions
377 #pragma mark Physics Methods
411 virtual void setDensity(
float value)
override;
Orientation _orient
Definition: CUCapsuleObstacle.h:107
virtual void releaseFixtures() override
static std::shared_ptr< CapsuleObstacle > alloc(const Vec2 &pos, const Size &size, Orientation orient)
Definition: CUCapsuleObstacle.h:288
virtual void resetDebug() override
virtual ~CapsuleObstacle()
Definition: CUCapsuleObstacle.h:156
void markDirty(bool value)
Definition: CUObstacle.h:811
virtual void createFixtures() override
float getSeamOffset() const
Definition: CUCapsuleObstacle.h:400
b2Fixture * _core
Definition: CUCapsuleObstacle.h:99
b2CircleShape _ends
Definition: CUCapsuleObstacle.h:94
static bool isHorizontal(Orientation value)
Definition: CUCapsuleObstacle.h:372
CapsuleObstacle(void)
Definition: CUCapsuleObstacle.h:144
Orientation
Definition: CUCapsuleObstacle.h:75
b2PolygonShape _shape
Definition: CUCapsuleObstacle.h:92
Definition: CUCapsuleObstacle.h:72
static const Size ZERO
Definition: CUSize.h:66
void setSeamOffset(float value)
virtual bool init(const Vec2 &pos) override
Definition: CUCapsuleObstacle.h:179
Definition: CUSimpleObstacle.h:63
float width
Definition: CUSize.h:61
b2Fixture * _cap1
Definition: CUCapsuleObstacle.h:101
void setWidth(float value)
Definition: CUCapsuleObstacle.h:330
void resize(const Size &size)
void setDimension(const Size &value)
Definition: CUCapsuleObstacle.h:308
b2Fixture * _cap2
Definition: CUCapsuleObstacle.h:103
float height
Definition: CUSize.h:63
virtual void setDensity(float value) override
b2AABB _center
Definition: CUCapsuleObstacle.h:96
void setHeight(float value)
Definition: CUCapsuleObstacle.h:344
float getWidth() const
Definition: CUCapsuleObstacle.h:323
float getHeight() const
Definition: CUCapsuleObstacle.h:337
void setDimension(float width, float height)
Definition: CUCapsuleObstacle.h:316
const Size & getDimension() const
Definition: CUCapsuleObstacle.h:301
virtual bool init() override
Definition: CUCapsuleObstacle.h:165
bool setOrientation(Orientation value)
Definition: CUAnimationNode.h:52
static const Vec2 ZERO
Definition: CUVec2.h:71
float _seamEpsilon
Definition: CUCapsuleObstacle.h:110
Size _dimension
Definition: CUCapsuleObstacle.h:105
static std::shared_ptr< CapsuleObstacle > alloc()
Definition: CUCapsuleObstacle.h:226
static std::shared_ptr< CapsuleObstacle > alloc(const Vec2 &pos, const Size &size)
Definition: CUCapsuleObstacle.h:265
const Orientation & getOrientation() const
Definition: CUCapsuleObstacle.h:351
static std::shared_ptr< CapsuleObstacle > alloc(const Vec2 &pos)
Definition: CUCapsuleObstacle.h:243