From d83f72d140537ca809e435bf2fe4926093589439 Mon Sep 17 00:00:00 2001 From: Neil Mendoza Date: Fri, 26 Jun 2015 15:12:14 -0700 Subject: [PATCH 1/9] vs2012 fixes --- libs/triangle/dpoint.hpp | 2 +- src/ofxBox2dPolygonUtils.h | 7 ++++--- 2 files changed, 5 insertions(+), 4 deletions(-) diff --git a/libs/triangle/dpoint.hpp b/libs/triangle/dpoint.hpp index 845c6a9..d875e6d 100644 --- a/libs/triangle/dpoint.hpp +++ b/libs/triangle/dpoint.hpp @@ -474,7 +474,7 @@ dpoint& dpoint::operator=(const dpoint &q) { #ifdef _MSC_VER - assert((this != &q), "Error p = p"); + assert(this != &q); #else Assert((this != &q), "Error p = p"); #endif diff --git a/src/ofxBox2dPolygonUtils.h b/src/ofxBox2dPolygonUtils.h index c4bda69..ecd34fe 100644 --- a/src/ofxBox2dPolygonUtils.h +++ b/src/ofxBox2dPolygonUtils.h @@ -112,9 +112,10 @@ static vector simplifyContour(vector &V, float tol) { float tol2 = tol * tol; // tolerance squared vector vt(n); - int mk[n]; + //int mk[n]; + vector mk(n, 0); - memset(mk, 0, sizeof(mk)); + //memset(mk, 0, sizeof(mk)); // STAGE 1. Vertex Reduction within tolerance of prior vertex cluster vt[0] = V[0]; // start at the beginning @@ -128,7 +129,7 @@ static vector simplifyContour(vector &V, float tol) { // STAGE 2. Douglas-Peucker polyline simplification mk[0] = mk[k-1] = 1; // mark the first and last vertices - simplifyDP( tol, &vt[0], 0, k-1, mk ); + simplifyDP( tol, &vt[0], 0, k-1, &mk[0] ); // copy marked vertices to the output simplified polyline for (i=m=0; i Date: Sun, 10 Jan 2016 15:56:59 -0800 Subject: [PATCH 2/9] first untested commit of revolute joint --- src/ofxBox2dRevoluteJoint.cpp | 220 ++++++++++++++++++++++++++++++++++ src/ofxBox2dRevoluteJoint.h | 56 +++++++++ 2 files changed, 276 insertions(+) create mode 100644 src/ofxBox2dRevoluteJoint.cpp create mode 100644 src/ofxBox2dRevoluteJoint.h diff --git a/src/ofxBox2dRevoluteJoint.cpp b/src/ofxBox2dRevoluteJoint.cpp new file mode 100644 index 0000000..2ceb06a --- /dev/null +++ b/src/ofxBox2dRevoluteJoint.cpp @@ -0,0 +1,220 @@ +/* + * ofxBox2dRevoluteJoint.cpp + * jointExample + * + * Created by Nick Hardeman on 1/19/11. + * Copyright 2011 Nick Hardeman. All rights reserved. + * + */ + +#include "ofxBox2dRevoluteJoint.h" + +//---------------------------------------- +ofxBox2dRevoluteJoint::ofxBox2dRevoluteJoint() { + world = NULL; + joint = NULL; + alive = false; +} + +//---------------------------------------- +ofxBox2dRevoluteJoint::ofxBox2dRevoluteJoint(b2World* b2world, b2Body* body1, b2Body* body2, float lowerAngle, float upperAngle, bool bCollideConnected) { + ofxBox2dRevoluteJoint(); + setup(b2world, body1, body2, lowerAngle, upperAngle, bCollideConnected); +} + +//---------------------------------------- +ofxBox2dRevoluteJoint::ofxBox2dRevoluteJoint(b2World* b2world, b2Body* body1, b2Body* body2, b2Vec2 anchor, float lowerAngle, float upperAngle, bool bCollideConnected) { + ofxBox2dRevoluteJoint(); + setup(b2world, body1, body2, anchor, lowerAngle, upperAngle, bCollideConnected); +} + +//---------------------------------------- +ofxBox2dRevoluteJoint::ofxBox2dRevoluteJoint(b2World* b2world, b2RevoluteJointDef jointDef) { + ofxBox2dRevoluteJoint(); + setup(b2world, jointDef); +} + +//---------------------------------------- +void ofxBox2dRevoluteJoint::setup(b2World* b2world, b2Body* body1, b2Body* body2, float lowerAngle, float upperAngle, bool bCollideConnected) { + + if(body1 == NULL || body2 == NULL) { + ofLog(OF_LOG_NOTICE, "ofxBox2dRevoluteJoint :: setup : - box2d body is NULL -"); + return; + } + + b2Vec2 a;//, a2; + a = body1->GetWorldCenter(); + //a2 = body2->GetWorldCenter(); + + setup(b2world, body1, body2, a, lowerAngle, upperAngle, bCollideConnected); + + alive = true; +} + +//---------------------------------------- +void ofxBox2dRevoluteJoint::setup(b2World* b2world, b2Body* body1, b2Body* body2, b2Vec2 anchor, float lowerAngle, float upperAngle, bool bCollideConnected) { + + if(body1 == NULL || body2 == NULL) { + ofLog(OF_LOG_NOTICE, "ofxBox2dRevoluteJoint :: setup : - box2d body is NULL -"); + return; + } + + b2RevoluteJointDef jointDef; + jointDef.Initialize(body1, body2, anchor); + jointDef.collideConnected = bCollideConnected; + jointDef.lowerAngle = lowerAngle; + jointDef.upperAngle = upperAngle; + + setup(b2world, jointDef); +} + +//---------------------------------------- +void ofxBox2dRevoluteJoint::setup(b2World* b2world, b2RevoluteJointDef jointDef) { + + setWorld(b2world); + + joint = (b2RevoluteJoint*)world->CreateJoint(&jointDef); + + alive = true; +} + +//---------------------------------------- +void ofxBox2dRevoluteJoint::setWorld(b2World* w) { + if(w == NULL) { + ofLog(OF_LOG_NOTICE, "ofxBox2dRevoluteJoint :: setWorld : - box2d world needed -"); + return; + } + world = w; +} + +//---------------------------------------- +bool ofxBox2dRevoluteJoint::isSetup() { + if (world == NULL) { + ofLog(OF_LOG_NOTICE, "ofxBox2dRevoluteJoint :: world must be set!"); + return false; + } + if (joint == NULL) { + ofLog(OF_LOG_NOTICE, "ofxBox2dRevoluteJoint :: setup function must be called!"); + return false; + } + return true; +} + + +//---------------------------------------- +void ofxBox2dRevoluteJoint::draw() { + if(!alive) return; + + b2Vec2 p1 = joint->GetAnchorA(); + b2Vec2 p2 = joint->GetAnchorB(); + + p1 *= OFX_BOX2D_SCALE; + p2 *= OFX_BOX2D_SCALE; + ofDrawLine(p1.x, p1.y, p2.x, p2.y); +} + +//---------------------------------------- +void ofxBox2dRevoluteJoint::destroy() { + if (!isSetup()) return; + if(joint) { + world->DestroyJoint(joint); + } + joint = NULL; + alive = false; +} + +void ofxBox2dRevoluteJoint::setLowerAngle(float lowerAngle) +{ + if (joint) joint->SetLimits(lowerAngle, joint->GetUpperLimit()); + else ofLogError() << "joint is null"; +} + +float ofxBox2dRevoluteJoint::getLowerAngle() const +{ + if (joint) return joint->GetLowerLimit(); + else + { + ofLogError() << "joint is null"; + return 0.f; + } +} + +void ofxBox2dRevoluteJoint::setUpperAngle(float upperAngle) +{ + if (joint) joint->SetLimits(joint->GetLowerLimit(), upperAngle); + else ofLogError() << "joint is null"; +} + +float ofxBox2dRevoluteJoint::getUpperAngle() const +{ + if (joint) return joint->GetUpperLimit(); + else + { + ofLogError() << "joint is null"; + return 0.f; + } +} + + +/* +//---------------------------------------- +void ofxBox2dRevoluteJoint::setLength(float len) { + if(joint) { + joint->SetLength((float32)b2dNum(len)); + } +} +float ofxBox2dRevoluteJoint::getLength() { + if(joint) { + return (float)joint->GetLength(); + } + return 0; +} + +//---------------------------------------- +void ofxBox2dRevoluteJoint::setFrequency(float freq) { + if(joint) { + joint->SetFrequency((float32)freq); + } +} +float ofxBox2dRevoluteJoint::getFrequency() { + if(joint) { + return (float)joint->GetFrequency(); + } + return 0; +} + +//---------------------------------------- +void ofxBox2dRevoluteJoint::setDamping(float ratio) { + if(joint) { + joint->SetDampingRatio((float32)ratio); + } +} +float ofxBox2dRevoluteJoint::getDamping() { + if(joint) { + return (float)joint->GetDampingRatio(); + } + return 0; +} +*/ + +//---------------------------------------- +ofVec2f ofxBox2dRevoluteJoint::getReactionForce(float inv_dt) const { + b2Vec2 vec = getReactionForceB2D(inv_dt); + return ofVec2f(vec.x, vec.y); +} +b2Vec2 ofxBox2dRevoluteJoint::getReactionForceB2D(float inv_dt) const { + if(joint) { + return joint->GetReactionForce(inv_dt); + } + return b2Vec2(0, 0); +} +float ofxBox2dRevoluteJoint::getReactionTorque(float inv_dt) const { + if(joint) { + return (float)joint->GetReactionTorque(inv_dt); + } + return 0; +} + + + + diff --git a/src/ofxBox2dRevoluteJoint.h b/src/ofxBox2dRevoluteJoint.h new file mode 100644 index 0000000..5703b1d --- /dev/null +++ b/src/ofxBox2dRevoluteJoint.h @@ -0,0 +1,56 @@ +#pragma once +#include "ofMain.h" +#include "Box2D.h" +#include "ofxBox2dUtils.h" + +#define BOX2D_DEFAULT_FREQ 4.0 +#define BOX2D_DEFAULT_DAMPING 0.5 + +class ofxBox2dRevoluteJoint { + +public: + b2World * world; + b2RevoluteJoint * joint; + int jointType; + bool alive; + + //---------------------------------------- + ofxBox2dRevoluteJoint(); + ofxBox2dRevoluteJoint(b2World* b2world, b2Body* body1, b2Body* body2, float lowerAngle=-HALF_PI, float upperAngle=HALF_PI, bool bCollideConnected=true); + ofxBox2dRevoluteJoint(b2World* b2world, b2Body* body1, b2Body* body2, b2Vec2 anchor, float lowerAngle=-HALF_PI, float upperAngle=HALF_PI, bool bCollideConnected=true); + ofxBox2dRevoluteJoint(b2World* b2world, b2RevoluteJointDef jointDef); + + //---------------------------------------- + void setWorld(b2World * w); + void setup(b2World* b2world, b2Body* body1, b2Body* body2, float lowerAngle=-HALF_PI, float upperAngle=HALF_PI, bool bCollideConnected=true); + void setup(b2World* b2world, b2Body* body1, b2Body* body2, b2Vec2 anchor, float lowerAngle=-HALF_PI, float upperAngle=HALF_PI, bool bCollideConnected=true); + void setup(b2World* b2world, b2RevoluteJointDef jointDef); + + //---------------------------------------- + bool isSetup(); + void draw(); + void destroy(); + + void setLowerAngle(float lowerAngle); + float getLowerAngle() const; + + void setUpperAngle(float upperAngle); + float getUpperAngle() const; + + //---------------------------------------- + ofVec2f getReactionForce(float inv_dt) const; + b2Vec2 getReactionForceB2D(float inv_dt) const; + float getReactionTorque(float inv_dt) const; +}; + + + + + + + + + + + + From 8e0e1c43ddb42f9f12b009256118e3dc8f153243 Mon Sep 17 00:00:00 2001 From: Neil Mendoza Date: Sun, 10 Jan 2016 16:27:25 -0800 Subject: [PATCH 3/9] added include to ofxBox2d.h --- src/ofxBox2d.h | 1 + 1 file changed, 1 insertion(+) diff --git a/src/ofxBox2d.h b/src/ofxBox2d.h index 911c5b9..49f37f7 100644 --- a/src/ofxBox2d.h +++ b/src/ofxBox2d.h @@ -10,6 +10,7 @@ #include "ofxBox2dRect.h" #include "ofxBox2dJoint.h" +#include "ofxBox2dRevoluteJoint.h" #include "ofxBox2dRender.h" #include "ofxBox2dContactListener.h" From c242ee168fb5c58c02d60f1270d7703571d5977f Mon Sep 17 00:00:00 2001 From: Neil Mendoza Date: Sun, 10 Jan 2016 16:42:51 -0800 Subject: [PATCH 4/9] added in enable limit --- src/ofxBox2dRevoluteJoint.cpp | 16 ++++++++-------- src/ofxBox2dRevoluteJoint.h | 8 ++++---- 2 files changed, 12 insertions(+), 12 deletions(-) diff --git a/src/ofxBox2dRevoluteJoint.cpp b/src/ofxBox2dRevoluteJoint.cpp index 2ceb06a..82504a9 100644 --- a/src/ofxBox2dRevoluteJoint.cpp +++ b/src/ofxBox2dRevoluteJoint.cpp @@ -17,15 +17,15 @@ ofxBox2dRevoluteJoint::ofxBox2dRevoluteJoint() { } //---------------------------------------- -ofxBox2dRevoluteJoint::ofxBox2dRevoluteJoint(b2World* b2world, b2Body* body1, b2Body* body2, float lowerAngle, float upperAngle, bool bCollideConnected) { +ofxBox2dRevoluteJoint::ofxBox2dRevoluteJoint(b2World* b2world, b2Body* body1, b2Body* body2, bool enableLimit, float lowerAngle, float upperAngle, bool bCollideConnected) { ofxBox2dRevoluteJoint(); - setup(b2world, body1, body2, lowerAngle, upperAngle, bCollideConnected); + setup(b2world, body1, body2, enableLimit, lowerAngle, upperAngle, bCollideConnected); } //---------------------------------------- -ofxBox2dRevoluteJoint::ofxBox2dRevoluteJoint(b2World* b2world, b2Body* body1, b2Body* body2, b2Vec2 anchor, float lowerAngle, float upperAngle, bool bCollideConnected) { +ofxBox2dRevoluteJoint::ofxBox2dRevoluteJoint(b2World* b2world, b2Body* body1, b2Body* body2, b2Vec2 anchor, bool enableLimit, float lowerAngle, float upperAngle, bool bCollideConnected) { ofxBox2dRevoluteJoint(); - setup(b2world, body1, body2, anchor, lowerAngle, upperAngle, bCollideConnected); + setup(b2world, body1, body2, anchor, enableLimit, lowerAngle, upperAngle, bCollideConnected); } //---------------------------------------- @@ -35,7 +35,7 @@ ofxBox2dRevoluteJoint::ofxBox2dRevoluteJoint(b2World* b2world, b2RevoluteJointDe } //---------------------------------------- -void ofxBox2dRevoluteJoint::setup(b2World* b2world, b2Body* body1, b2Body* body2, float lowerAngle, float upperAngle, bool bCollideConnected) { +void ofxBox2dRevoluteJoint::setup(b2World* b2world, b2Body* body1, b2Body* body2, bool enableLimit, float lowerAngle, float upperAngle, bool bCollideConnected) { if(body1 == NULL || body2 == NULL) { ofLog(OF_LOG_NOTICE, "ofxBox2dRevoluteJoint :: setup : - box2d body is NULL -"); @@ -44,15 +44,14 @@ void ofxBox2dRevoluteJoint::setup(b2World* b2world, b2Body* body1, b2Body* body2 b2Vec2 a;//, a2; a = body1->GetWorldCenter(); - //a2 = body2->GetWorldCenter(); - setup(b2world, body1, body2, a, lowerAngle, upperAngle, bCollideConnected); + setup(b2world, body1, body2, a, enableLimit, lowerAngle, upperAngle, bCollideConnected); alive = true; } //---------------------------------------- -void ofxBox2dRevoluteJoint::setup(b2World* b2world, b2Body* body1, b2Body* body2, b2Vec2 anchor, float lowerAngle, float upperAngle, bool bCollideConnected) { +void ofxBox2dRevoluteJoint::setup(b2World* b2world, b2Body* body1, b2Body* body2, b2Vec2 anchor, bool enableLimit, float lowerAngle, float upperAngle, bool bCollideConnected) { if(body1 == NULL || body2 == NULL) { ofLog(OF_LOG_NOTICE, "ofxBox2dRevoluteJoint :: setup : - box2d body is NULL -"); @@ -64,6 +63,7 @@ void ofxBox2dRevoluteJoint::setup(b2World* b2world, b2Body* body1, b2Body* body2 jointDef.collideConnected = bCollideConnected; jointDef.lowerAngle = lowerAngle; jointDef.upperAngle = upperAngle; + jointDef.enableLimit = enableLimit; setup(b2world, jointDef); } diff --git a/src/ofxBox2dRevoluteJoint.h b/src/ofxBox2dRevoluteJoint.h index 5703b1d..39374d7 100644 --- a/src/ofxBox2dRevoluteJoint.h +++ b/src/ofxBox2dRevoluteJoint.h @@ -16,14 +16,14 @@ class ofxBox2dRevoluteJoint { //---------------------------------------- ofxBox2dRevoluteJoint(); - ofxBox2dRevoluteJoint(b2World* b2world, b2Body* body1, b2Body* body2, float lowerAngle=-HALF_PI, float upperAngle=HALF_PI, bool bCollideConnected=true); - ofxBox2dRevoluteJoint(b2World* b2world, b2Body* body1, b2Body* body2, b2Vec2 anchor, float lowerAngle=-HALF_PI, float upperAngle=HALF_PI, bool bCollideConnected=true); + ofxBox2dRevoluteJoint(b2World* b2world, b2Body* body1, b2Body* body2, bool enableLimit = false, float lowerAngle = -.25f * PI, float upperAngle = .25f * PI, bool bCollideConnected = true); + ofxBox2dRevoluteJoint(b2World* b2world, b2Body* body1, b2Body* body2, b2Vec2 anchor, bool enableLimit = false, float lowerAngle = -.25f * PI, float upperAngle = .25f * PI, bool bCollideConnected = true); ofxBox2dRevoluteJoint(b2World* b2world, b2RevoluteJointDef jointDef); //---------------------------------------- void setWorld(b2World * w); - void setup(b2World* b2world, b2Body* body1, b2Body* body2, float lowerAngle=-HALF_PI, float upperAngle=HALF_PI, bool bCollideConnected=true); - void setup(b2World* b2world, b2Body* body1, b2Body* body2, b2Vec2 anchor, float lowerAngle=-HALF_PI, float upperAngle=HALF_PI, bool bCollideConnected=true); + void setup(b2World* b2world, b2Body* body1, b2Body* body2, bool enableLimit = false, float lowerAngle = -.25f * PI, float upperAngle = .25f * PI, bool bCollideConnected = true); + void setup(b2World* b2world, b2Body* body1, b2Body* body2, b2Vec2 anchor, bool enableLimit = false, float lowerAngle = -.25f * PI, float upperAngle = .25f * PI, bool bCollideConnected = true); void setup(b2World* b2world, b2RevoluteJointDef jointDef); //---------------------------------------- From 2b8101369919756f5dc98a90a9a037bf48fae66f Mon Sep 17 00:00:00 2001 From: Neil Mendoza Date: Sun, 10 Jan 2016 16:52:56 -0800 Subject: [PATCH 5/9] added getters and setters for enable limit --- src/ofxBox2dRevoluteJoint.cpp | 15 +++++++++++++++ src/ofxBox2dRevoluteJoint.h | 5 ++++- 2 files changed, 19 insertions(+), 1 deletion(-) diff --git a/src/ofxBox2dRevoluteJoint.cpp b/src/ofxBox2dRevoluteJoint.cpp index 82504a9..b437e46 100644 --- a/src/ofxBox2dRevoluteJoint.cpp +++ b/src/ofxBox2dRevoluteJoint.cpp @@ -155,6 +155,21 @@ float ofxBox2dRevoluteJoint::getUpperAngle() const } } +void ofxBox2dRevoluteJoint::setEnableLimit(bool enableLimit) +{ + if (joint) joint->EnableLimit(enableLimit); + else ofLogError() << "joint is null"; +} + +bool ofxBox2dRevoluteJoint::getEnableLimit() const +{ + if (joint) return joint->IsLimitEnabled(); + else + { + ofLogError() << "joint is null"; + return false; + } +} /* //---------------------------------------- diff --git a/src/ofxBox2dRevoluteJoint.h b/src/ofxBox2dRevoluteJoint.h index 39374d7..f957d14 100644 --- a/src/ofxBox2dRevoluteJoint.h +++ b/src/ofxBox2dRevoluteJoint.h @@ -36,7 +36,10 @@ class ofxBox2dRevoluteJoint { void setUpperAngle(float upperAngle); float getUpperAngle() const; - + + void setEnableLimit(bool enableLimit); + bool getEnableLimit() const; + //---------------------------------------- ofVec2f getReactionForce(float inv_dt) const; b2Vec2 getReactionForceB2D(float inv_dt) const; From db1c8c5e293d7ae9210dc982e535ea9b9a53b9dc Mon Sep 17 00:00:00 2001 From: Neil Mendoza Date: Sun, 10 Jan 2016 17:00:49 -0800 Subject: [PATCH 6/9] tidy up --- src/ofxBox2dRevoluteJoint.cpp | 47 +++-------------------------------- 1 file changed, 3 insertions(+), 44 deletions(-) diff --git a/src/ofxBox2dRevoluteJoint.cpp b/src/ofxBox2dRevoluteJoint.cpp index b437e46..7870de3 100644 --- a/src/ofxBox2dRevoluteJoint.cpp +++ b/src/ofxBox2dRevoluteJoint.cpp @@ -2,8 +2,8 @@ * ofxBox2dRevoluteJoint.cpp * jointExample * - * Created by Nick Hardeman on 1/19/11. - * Copyright 2011 Nick Hardeman. All rights reserved. + * Created by Neil Mendoza on 1/10/16. + * Copyright 2016 Neil Mendoza. All rights reserved. * */ @@ -42,7 +42,7 @@ void ofxBox2dRevoluteJoint::setup(b2World* b2world, b2Body* body1, b2Body* body2 return; } - b2Vec2 a;//, a2; + b2Vec2 a; a = body1->GetWorldCenter(); setup(b2world, body1, body2, a, enableLimit, lowerAngle, upperAngle, bCollideConnected); @@ -171,47 +171,6 @@ bool ofxBox2dRevoluteJoint::getEnableLimit() const } } -/* -//---------------------------------------- -void ofxBox2dRevoluteJoint::setLength(float len) { - if(joint) { - joint->SetLength((float32)b2dNum(len)); - } -} -float ofxBox2dRevoluteJoint::getLength() { - if(joint) { - return (float)joint->GetLength(); - } - return 0; -} - -//---------------------------------------- -void ofxBox2dRevoluteJoint::setFrequency(float freq) { - if(joint) { - joint->SetFrequency((float32)freq); - } -} -float ofxBox2dRevoluteJoint::getFrequency() { - if(joint) { - return (float)joint->GetFrequency(); - } - return 0; -} - -//---------------------------------------- -void ofxBox2dRevoluteJoint::setDamping(float ratio) { - if(joint) { - joint->SetDampingRatio((float32)ratio); - } -} -float ofxBox2dRevoluteJoint::getDamping() { - if(joint) { - return (float)joint->GetDampingRatio(); - } - return 0; -} -*/ - //---------------------------------------- ofVec2f ofxBox2dRevoluteJoint::getReactionForce(float inv_dt) const { b2Vec2 vec = getReactionForceB2D(inv_dt); From b81e33a7178f70867e12953c23af159228689480 Mon Sep 17 00:00:00 2001 From: Neil Mendoza Date: Sun, 10 Jan 2016 17:02:11 -0800 Subject: [PATCH 7/9] tidy up --- src/ofxBox2dRevoluteJoint.h | 3 --- 1 file changed, 3 deletions(-) diff --git a/src/ofxBox2dRevoluteJoint.h b/src/ofxBox2dRevoluteJoint.h index f957d14..0a0fd00 100644 --- a/src/ofxBox2dRevoluteJoint.h +++ b/src/ofxBox2dRevoluteJoint.h @@ -3,9 +3,6 @@ #include "Box2D.h" #include "ofxBox2dUtils.h" -#define BOX2D_DEFAULT_FREQ 4.0 -#define BOX2D_DEFAULT_DAMPING 0.5 - class ofxBox2dRevoluteJoint { public: From d3de217c3fcdac95e65eea9f7ce74c86eba8d5e4 Mon Sep 17 00:00:00 2001 From: Neil Mendoza Date: Sun, 10 Jan 2016 17:02:30 -0800 Subject: [PATCH 8/9] tidy up --- src/ofxBox2dRevoluteJoint.h | 1 - 1 file changed, 1 deletion(-) diff --git a/src/ofxBox2dRevoluteJoint.h b/src/ofxBox2dRevoluteJoint.h index 0a0fd00..151492f 100644 --- a/src/ofxBox2dRevoluteJoint.h +++ b/src/ofxBox2dRevoluteJoint.h @@ -8,7 +8,6 @@ class ofxBox2dRevoluteJoint { public: b2World * world; b2RevoluteJoint * joint; - int jointType; bool alive; //---------------------------------------- From b1bbc3c79dfab45df4ebf0ed757cae43786fb737 Mon Sep 17 00:00:00 2001 From: Neil Mendoza Date: Tue, 5 Apr 2016 21:08:52 -0700 Subject: [PATCH 9/9] changed default bCollideConnected to false, seems more sensible --- src/ofxBox2dRevoluteJoint.h | 8 ++++---- 1 file changed, 4 insertions(+), 4 deletions(-) diff --git a/src/ofxBox2dRevoluteJoint.h b/src/ofxBox2dRevoluteJoint.h index 151492f..ff5f800 100644 --- a/src/ofxBox2dRevoluteJoint.h +++ b/src/ofxBox2dRevoluteJoint.h @@ -12,14 +12,14 @@ class ofxBox2dRevoluteJoint { //---------------------------------------- ofxBox2dRevoluteJoint(); - ofxBox2dRevoluteJoint(b2World* b2world, b2Body* body1, b2Body* body2, bool enableLimit = false, float lowerAngle = -.25f * PI, float upperAngle = .25f * PI, bool bCollideConnected = true); - ofxBox2dRevoluteJoint(b2World* b2world, b2Body* body1, b2Body* body2, b2Vec2 anchor, bool enableLimit = false, float lowerAngle = -.25f * PI, float upperAngle = .25f * PI, bool bCollideConnected = true); + ofxBox2dRevoluteJoint(b2World* b2world, b2Body* body1, b2Body* body2, bool enableLimit = false, float lowerAngle = -.25f * PI, float upperAngle = .25f * PI, bool bCollideConnected = false); + ofxBox2dRevoluteJoint(b2World* b2world, b2Body* body1, b2Body* body2, b2Vec2 anchor, bool enableLimit = false, float lowerAngle = -.25f * PI, float upperAngle = .25f * PI, bool bCollideConnected = false); ofxBox2dRevoluteJoint(b2World* b2world, b2RevoluteJointDef jointDef); //---------------------------------------- void setWorld(b2World * w); - void setup(b2World* b2world, b2Body* body1, b2Body* body2, bool enableLimit = false, float lowerAngle = -.25f * PI, float upperAngle = .25f * PI, bool bCollideConnected = true); - void setup(b2World* b2world, b2Body* body1, b2Body* body2, b2Vec2 anchor, bool enableLimit = false, float lowerAngle = -.25f * PI, float upperAngle = .25f * PI, bool bCollideConnected = true); + void setup(b2World* b2world, b2Body* body1, b2Body* body2, bool enableLimit = false, float lowerAngle = -.25f * PI, float upperAngle = .25f * PI, bool bCollideConnected = false); + void setup(b2World* b2world, b2Body* body1, b2Body* body2, b2Vec2 anchor, bool enableLimit = false, float lowerAngle = -.25f * PI, float upperAngle = .25f * PI, bool bCollideConnected = false); void setup(b2World* b2world, b2RevoluteJointDef jointDef); //----------------------------------------