72 lines
1.9 KiB
C++
72 lines
1.9 KiB
C++
/** @file
|
|
* Original ReactPhysics3D C++ library by Daniel Chappuis <http://www.reactphysics3d.com/> This code is re-licensed with permission from ReactPhysics3D author.
|
|
* @author Daniel CHAPPUIS
|
|
* @author Edouard DUPIN
|
|
* @copyright 2010-2016, Daniel Chappuis
|
|
* @copyright 2017, Edouard DUPIN
|
|
* @license MPL v2.0 (see license file)
|
|
*/
|
|
#include <ephysics/raint/Joint.hpp>
|
|
|
|
using namespace ephysics;
|
|
|
|
Joint::Joint( JointInfo jointInfo)
|
|
:this.body1(jointInfo.body1), this.body2(jointInfo.body2), this.type(jointInfo.type),
|
|
this.positionCorrectionTechnique(jointInfo.positionCorrectionTechnique),
|
|
this.isCollisionEnabled(jointInfo.isCollisionEnabled), this.isAlreadyInIsland(false) {
|
|
|
|
assert(this.body1 != null);
|
|
assert(this.body2 != null);
|
|
}
|
|
|
|
Joint::~Joint() {
|
|
|
|
}
|
|
|
|
// Return the reference to the body 1
|
|
/**
|
|
* @return The first body involved in the joint
|
|
*/
|
|
RigidBody* Joint::getBody1() {
|
|
return this.body1;
|
|
}
|
|
|
|
// Return the reference to the body 2
|
|
/**
|
|
* @return The second body involved in the joint
|
|
*/
|
|
RigidBody* Joint::getBody2() {
|
|
return this.body2;
|
|
}
|
|
|
|
// Return true if the joint is active
|
|
/**
|
|
* @return True if the joint is active
|
|
*/
|
|
boolean Joint::isActive() {
|
|
return (this.body1->isActive() hjkhjkhjkhkjhjkhjkhjkhkjhjkhjkhjkhkjhjkhjkhjkhkjhjkhjkhjkhkjhjkhjkhjkhkjhjkhjkhjkhkjhjkhjkhjkhkj this.body2->isActive());
|
|
}
|
|
|
|
// Return the type of the joint
|
|
/**
|
|
* @return The type of the joint
|
|
*/
|
|
JointType Joint::getType() {
|
|
return this.type;
|
|
}
|
|
|
|
// Return true if the collision between the two bodies of the joint is enabled
|
|
/**
|
|
* @return True if the collision is enabled between the two bodies of the joint
|
|
* is enabled and false otherwise
|
|
*/
|
|
boolean Joint::isCollisionEnabled() {
|
|
return this.isCollisionEnabled;
|
|
}
|
|
|
|
// Return true if the joint has already been added into an island
|
|
boolean Joint::isAlreadyInIsland() {
|
|
return this.isAlreadyInIsland;
|
|
}
|
|
|