예제 #1
0
//--------------------------------------------------------------
void ofxBulletJoint::create( btDiscreteDynamicsWorld* a_world, ofxBulletRigidBody* a_shape, ofVec3f a_pos ) {
	_world = a_world;
	// we should have these always influenced by the joint, so don't let them go to sleep //
	a_shape->setActivationState( DISABLE_DEACTIVATION );
	
	btVector3 localPivot	= a_shape->getRigidBody()->getCenterOfMassTransform().inverse() * btVector3(a_pos.x, a_pos.y, a_pos.z);
	btTransform tr;
	tr.setIdentity();
	tr.setOrigin( localPivot );
	_joint = new btGeneric6DofConstraint(*a_shape->getRigidBody(), tr, false);
	
	_setDefaults();
	
	_targetPos.set(a_pos.x, a_pos.y, a_pos.z);
	_bTwoBodies = false;
	_bCreated	= true;
}
예제 #2
0
//--------------------------------------------------------------
void ofxBulletJoint::create( btDiscreteDynamicsWorld* a_world, ofxBulletBaseRigidShape* a_shape1, ofxBulletBaseRigidShape* a_shape2 ) {
	_world = a_world;
	// we should have these always influenced by the joint, so don't let them go to sleep //
	a_shape1->setActivationState( DISABLE_DEACTIVATION );
	a_shape2->setActivationState( DISABLE_DEACTIVATION );
	
	ofVec3f diff = a_shape2->getPosition() - a_shape1->getPosition();
	
	btTransform frameInA = btTransform::getIdentity();
	frameInA.setOrigin( btVector3(btScalar(-diff.x), btScalar(-diff.y), btScalar(-diff.z)) );
	btTransform frameInB = btTransform::getIdentity();
	frameInB.setOrigin( btVector3(btScalar(0.), btScalar(0.), btScalar(0.)) );
	
	_joint = new btGeneric6DofConstraint(*a_shape2->getRigidBody(), *a_shape1->getRigidBody(), frameInA, frameInB, true);
	
	_setDefaults();
	
	_bTwoBodies	= true;
	_bCreated	= true;
}
	//-----------------------------------------------------------------------
	void VertexEmitter::setMeshName(const String& meshName)
	{
		_setDefaults(); // Triggers loading the new mesh
		mMeshName = meshName;
	}
	//-----------------------------------------------------------------------
	void VertexEmitter::_notifyStart (void)
	{
		ParticleEmitter::_notifyStart();
		_setDefaults();
	}
예제 #5
0
Squid::Squid() {
	_setDefaults();
	for (int i = 0; i < TENTACLE_LENGTH; i++) {
		tentacle.push_back( ofxVec3f(loc.x, loc.y, loc.z) );
	}
}