コード例 #1
0
void NodeGraphDisplay::initGraph()
{
	if(nodeGraph)
	{
		/*
		std::vector<Node*> nodes = nodeGraph->getNodes();
		
		if(nodes.size > 0)
		{
			Vec2f	step(100.0f, 100.0f);
			Point2f max_pos(step.x,step.y),
					min_pos(0.0f, 0.0f);

			std::unordered_set<Node*> visited_nodes;
		
			initNodeControl(nodes[0], Point2f(0.0f, 0.0f), step, visited_nodes, max_pos, min_pos);
		}
		//else no nodes
		*/


		//Add node controls
		const std::vector<Node*> &nodes = nodeGraph->getNodes();
		const std::vector<Point2f> &initial_pos = nodeGraph->getInitialPos();

		nodeControls.reserve(nodes.size());
		
		//Create NodeControls
		for(unsigned int i = 0; i < nodes.size(); i++)
		{
			NodeControl *nc = new NodeControl(this, nodes[i], initial_pos[i]);
			nodeControls.push_back(nc);
			addBody(nc);
		}

		//Create NodeConnectionControls
		for(unsigned int i = 0; i < nodeControls.size(); i++)
		{
			//Connections
			for(auto from : nodes[i]->getConnectors())
			{
				//Only make output connections (to avoid duplicates)
				if(from->ioType == NCType::DATA_OUTPUT || from->ioType == NCType::INFO_OUTPUT)
				{
					for(NodeConnector::CIndex i = 0; i < from->numConnections(); i++)
						addConnection(from->getId(), from->getConnection(i)->getId());
				}
			}
		}
	}
}
コード例 #2
0
ファイル: main.c プロジェクト: btheobald/bhnsim
void addStructure(node *treeRoot, int p_soBodies, float p_xP, float p_yP,
                  float p_coS, float p_sR) {
  // Create a Pseudo-random circular distribution of bodies around a central
  // body.
  float max = p_sR * 2;

  // Temporary Variables
  double tempRand, tempCirX, tempCirY;
  // Add Central Body
  addBody(createBody(1, p_xP, p_yP, 0, 0), treeRoot);

  for (int bIDC = 0; bIDC < p_soBodies; bIDC++) {
    // Ensure that bodies are not too close to center.
    do {
      tempRand = (((float)rand() / (float)(RAND_MAX)) * max) - p_sR;
    } while ((tempRand < p_coS) & (tempRand > -p_coS));
    // Map to Circle
    tempCirX = p_xP + (tempRand * cos(2 * 3.14592 * tempRand));
    tempCirY = p_yP + (tempRand * sin(2 * 3.14592 * tempRand));

    addBody(createBody(1, tempCirX, tempCirY, 0, 0), treeRoot);
  }
}
コード例 #3
0
ファイル: bullet.cpp プロジェクト: wot123/flyer2d
// ============================================================================
// Constructor
Bullet::Bullet ( World* pWorld ) : PhysicalObject ( pWorld )
{
	_lifespan = 0;
	_mass = 0;
	_size = 0;
	_age = 0;
	setLayers( PhysLayerVehicles | PhysLayerBuildings );
	setName( "Bullet" );
	setRenderLayer( LayerVehicles );
	
	_pBody = new Body( "Bullet" );
	_pBody->setDamageMultiplier( DAMAGE_MULTIPLIER );
	addBody( _pBody, 0 );
	setMainBody( _pBody );
}
コード例 #4
0
GameState::GameState(Tmx::Map const* map, hgeResourceManager* res) {
	env = new Environment(map, res);

	for (Tmx::ObjectGroup const* ob : map->GetObjectGroups()) {
		if (ob->GetName() != "BodyLayer")
			continue;
		for (Tmx::Object const* o : ob->GetObjects()) {
			if (o->GetType() == "Body") {
				addBody(new IBody(o, res));
			} else if (o->GetType() == "Hero") {
				setHero(new IBody(o, res));
			}
		}
	}
	rData.target1 = res->GetTarget("GameStateTarget1");
	if (rData.target1 == 0) {
		std::cerr << "Can't find GameStateTarget1\n";
		exit(0);
	}

	rData.target2 = res->GetTarget("GameStateTarget2");
	if (rData.target2 == 0) {
		std::cerr << "Can't find GameStateTarget2\n";
		exit(0);
	}

	rData.target3 = res->GetTarget("GameStateTarget3");
	if (rData.target3 == 0) {
		std::cerr << "Can't find GameStateTarget3\n";
		exit(0);
	}

	rData.blurShader = res->GetShader("BlurShader");
	if (rData.blurShader == NULL) {
		std::cerr << "Can't find BlurShader\n";
		exit(0);
	}

	rData.kSize = 9;
	rData.dirX[0] = 0.002f, rData.dirX[1] = 0.f;
	rData.dirY[0] = 0.f, rData.dirY[1] = 0.002f;
	rData.sigma = 3.f;
	for (int i = -rData.kSize/2; i <= rData.kSize/2; ++i) {
		rData.kernel[i+rData.kSize/2] = rData.gaussian(rData.dirX[0]*i, rData.sigma);
	}

}
コード例 #5
0
void Universe::generate(int numberOfBodies, int timeToCollision){
    numberOfBodies = 2; /*just for now, we only want two more planets*/
    orbitRadius = 250;
    rotationalSpeeds = new float[numberOfBodies];
    float baseRotateSpeed = .05; /*how fast the slower of the two bodies moves*/
    rotationalSpeeds[0] = baseRotateSpeed;
    for(int i = 0; i<numberOfBodies; i++){
        if(i!=0){
            addBody(new CelestialBody(sf::Vector2f(Upos.x, Upos.y) ,10,10));
        }
        secondaryBodies[i]->setOrigin(sf::Vector2f(-orbitRadius,secondaryBodies[secondaryBodies.size() -1]->size));
        secondaryBodies[i]->changeColor(*(new sf::Color(rand()%255,rand()%255,rand()%255)));
    }
    /*will only work for two bodies*/
    if(numberOfBodies = 2){
        float secondRotate = -90;
        secondaryBodies[1]->rotate(secondRotate); //second planet, first will always be player planet
        rotationalSpeeds[1] = baseRotateSpeed + ((-1*secondRotate)/(timeToCollision*1.05));

    }

}
コード例 #6
0
ファイル: dependency_graph.cpp プロジェクト: klusark/sat
// Creates a positive-body-atom-dependency graph (PBADG)
// The PBADG contains a node for each atom A of a non-trivial SCC and
// a node for each body B, s.th. there is a non-trivially connected atom A with
// B in body(A).
// Pre : a->ignore  = 0 for all new and relevant atoms a
// Pre : b->visited = 1 for all new and relevant bodies b
// Post: a->ignore  = 1 for all atoms that were added to the PBADG
// Post: b->visited = 0 for all bodies that were added to the PBADG
void SharedDependencyGraph::addSccs(SharedContext& ctx, const AtomList& sccAtoms, const AtomList& prgAtoms, const BodyList& prgBodies) {
	// Pass 1: Create graph atom nodes and estimate number of bodies
	NodeId atomId = static_cast<NodeId>(atoms_.size());
	atoms_.reserve(atoms_.size() + sccAtoms.size());
	AtomList::size_type numBodies = 0;
	for (AtomList::size_type i = 0, end = sccAtoms.size(); i != end; ++i) {
		PrgAtomNode* a = sccAtoms[i];
		if (relevantPrgAtom(*ctx.master(), a)) {
			// initialize graph atom node
			atoms_.push_back(AtomNode());
			AtomNode& ua = atoms_.back();
			ua.lit       = a->literal();
			ua.scc       = a->scc();
			numBodies   += a->preds.size();
			// store link between program node and graph node for later lookup
			a->setUfsNode(atomId, true);
			// atom is defined by more than just a bunch of clauses
			ctx.setFrozen(a->var(), true);
			++atomId;
		}
	}
	// Pass 2: Init atom nodes and create body nodes
	VarVec preds, succs, succsExt;
	NodeId* temp;
	bodies_.reserve(bodies_.size() + numBodies/2);
	for (AtomList::size_type i = 0, end = sccAtoms.size(); i != end; ++i) {
		PrgAtomNode* a = sccAtoms[i];
		if (relevantPrgAtom(*ctx.master(), a)) { 
			AtomNode& ua = atoms_[a->ufsNode()];
			for (HeadVec::const_iterator it = a->preds.begin(), endIt = a->preds.end(); it != endIt; ++it) {
				PrgBodyNode* prgBody = prgBodies[it->node()];
				if (relevantPrgBody(*ctx.master(), prgBody)) {
					NodeId bId = addBody(ctx, prgBody, prgAtoms);
					VarVec::iterator insPos = prgBody->scc() == a->scc() ? preds.end() : preds.begin();
					preds.insert(insPos, bId);
					if (it->choice()) {
						ua.type |= Node::type_in_choice;
					}
				}
			}
			for (VarVec::const_iterator it = a->posDep.begin(), endIt = a->posDep.end(); it != endIt; ++it) {
				PrgBodyNode* prgBody = prgBodies[*it];
				if (prgBody->scc() == a->scc() && relevantPrgBody(*ctx.master(), prgBody)) {
					NodeId bodyId = addBody(ctx, prgBody, prgAtoms);
					if (!bodies_[bodyId].extended()) {
						succs.push_back(bodyId);
					}
					else {
						succsExt.push_back(bodyId);
						succsExt.push_back(bodies_[bodyId].get_pred_idx(a->ufsNode()));
						assert(bodies_[bodyId].get_pred(succsExt.back()) == a->ufsNode());
						ua.type |= Node::type_ext;
					}
				}
			}
			succs.push_back(idMax);
			if (!succsExt.empty()) {
				succsExt.push_back(idMax);
			}
			ua.adj_   = new NodeId[preds.size()+succs.size()+succsExt.size()];
			ua.sep_   = std::copy(preds.begin(), preds.end(), ua.adj_);
			temp      = std::copy(succs.begin(), succs.end(), ua.sep_);
			std::copy(succsExt.begin(), succsExt.end(), temp);
			preds.clear(); succs.clear(); succsExt.clear();
		}
	}	
}
コード例 #7
0
ファイル: RigidBody.cpp プロジェクト: bagobor/tx
void RigidBody::selfAddBody_() {
	addBody(getPhysics());
}
コード例 #8
0
ファイル: QtButton.cpp プロジェクト: adroitly/QtEdit
void QtButton::mousePressEvent(QMouseEvent *e)
{
	_QtEdit = QtEdit::getInstance();
	if (e->button() ==  Qt::RightButton && this_button_id <= _QtEdit->FPX)
	{
		//if (Is_AttFra || Is_InjFra || Is_ActFra || Is_BodyFra)
		if (_QtEdit->is_import)
		{
			_QtEdit->_DrawRectLayer->EndUpdate();
			if (_QtEdit->is_import)
			{
				//_QtEdit->_DrawRectLayer->unscheduleUpdate();
				_QtEdit->_DrawRectLayer->EndUpdate();
				_QtEdit->ui.PauseButton->setText("Start");
				_QtEdit->pu = -1;
				//_DrawRectLayer->drawPositionEdit(btn->Singl_ID);
			}
			_QtEdit->btn = this;
			_QtEdit->SlderAnimationAction();
			popMenu = new QMenu(this);
			if (Is_ActFra)
			{
				DeleteActAction = new QAction(this);
				DeleteActAction->setObjectName(QStringLiteral("mydeleteAction"));
				DeleteActAction->setText(QStringLiteral("ɾ³ý¶¯×÷¹Ø¼üÖ¡"));
				QObject::connect(DeleteActAction, SIGNAL(triggered()), this, SLOT(deleteAct()));
				popMenu->addAction(DeleteActAction);
				popMenu->addSeparator();
			}
			if (Is_AttFra)
			{
				DeleteAttAction = new QAction(this);
				DeleteAttAction->setObjectName(QStringLiteral("mydeleteAction"));
				DeleteAttAction->setText(QStringLiteral("ɾ³ý¹¥»÷¹Ø¼üÖ¡"));
				QObject::connect(DeleteAttAction, SIGNAL(triggered()), this, SLOT(deleteAtt()));
				popMenu->addAction(DeleteAttAction);
				ClearAttAction = new QAction(this);
				ClearAttAction->setObjectName(QStringLiteral("mydeleteAction"));
				ClearAttAction->setText(QStringLiteral("Çå¿Õ¹¥»÷¹Ø¼üÖ¡"));
				QObject::connect(ClearAttAction, SIGNAL(triggered()), this, SLOT(clearAtt()));
				popMenu->addAction(ClearAttAction);
				popMenu->addSeparator();
			}
			else
			{
				AddAttAction = new QAction(this);
				AddAttAction->setObjectName(QStringLiteral("mydeleteAction"));
				AddAttAction->setText(QStringLiteral("Ôö¼Ó¹¥»÷¹Ø¼üÖ¡"));
				QObject::connect(AddAttAction, SIGNAL(triggered()), this, SLOT(addAtt()));
				popMenu->addAction(AddAttAction);
				popMenu->addSeparator();
			}
			if (Is_InjFra)
			{
				DeleteInjAction = new QAction(this);
				DeleteInjAction->setObjectName(QStringLiteral("mydeleteAction"));
				DeleteInjAction->setText(QStringLiteral("ɾ³ýÊÜ»÷¹Ø¼üÖ¡"));
				QObject::connect(DeleteInjAction, SIGNAL(triggered()), this, SLOT(deleteInj()));
				popMenu->addAction(DeleteInjAction);
				ClearInjAction = new QAction(this);
				ClearInjAction->setObjectName(QStringLiteral("mydeleteAction"));
				ClearInjAction->setText(QStringLiteral("Çå¿ÕÊÜ»÷¹Ø¼üÖ¡"));
				QObject::connect(ClearInjAction, SIGNAL(triggered()), this, SLOT(clearInj()));
				popMenu->addAction(ClearInjAction);
				popMenu->addSeparator();
			}
			else
			{
				AddInjAction = new QAction(this);
				AddInjAction->setObjectName(QStringLiteral("mydeleteAction"));
				AddInjAction->setText(QStringLiteral("Ôö¼ÓÊÜ»÷¹Ø¼üÖ¡"));
				QObject::connect(AddInjAction, SIGNAL(triggered()), this, SLOT(addInj()));
				popMenu->addAction(AddInjAction);
				popMenu->addSeparator();
			}
			if (Is_BodyFra)
			{
				DeleteBodyAction = new QAction(this);
				DeleteBodyAction->setObjectName(QStringLiteral("mydeleteAction"));
				DeleteBodyAction->setText(QStringLiteral("ɾ³ýÅöײ¹Ø¼üÖ¡"));
				QObject::connect(DeleteBodyAction, SIGNAL(triggered()), this, SLOT(deleteBody()));
				popMenu->addAction(DeleteBodyAction);
				ClearBodyAction = new QAction(this);
				ClearBodyAction->setObjectName(QStringLiteral("mydeleteAction"));
				ClearBodyAction->setText(QStringLiteral("Çå¿ÕÅöײ¹Ø¼üÖ¡"));
				QObject::connect(ClearBodyAction, SIGNAL(triggered()), this, SLOT(clearBody()));
				popMenu->addAction(ClearBodyAction);
				popMenu->addSeparator();
			}
			else
			{
				AddBodyAction = new QAction(this);
				AddBodyAction->setObjectName(QStringLiteral("mydeleteAction"));
				AddBodyAction->setText(QStringLiteral("Ôö¼ÓÅöײ¹Ø¼üÖ¡"));
				QObject::connect(AddBodyAction, SIGNAL(triggered()), this, SLOT(addBody()));
				popMenu->addAction(AddBodyAction);
				popMenu->addSeparator();
			}
			if (Is_EffFra)
			{
				DeleteEffAction = new QAction(this);
				DeleteEffAction->setObjectName(QStringLiteral("mydeleteAction"));
				DeleteEffAction->setText(QStringLiteral("ɾ³ýÌØЧ¹Ø¼üÖ¡"));
				QObject::connect(DeleteEffAction, SIGNAL(triggered()), this, SLOT(deleteEff()));
				popMenu->addAction(DeleteEffAction);
				ClearEffAction = new QAction(this);
				ClearEffAction->setObjectName(QStringLiteral("mydeleteAction"));
				ClearEffAction->setText(QStringLiteral("Çå¿ÕÌØЧ¹Ø¼üÖ¡"));
				QObject::connect(ClearEffAction, SIGNAL(triggered()), this, SLOT(clearEff()));
				popMenu->addAction(ClearEffAction);
				popMenu->addSeparator();
			}
			else
			{
				AddEffAction = new QAction(this);
				AddEffAction->setObjectName(QStringLiteral("mydeleteAction"));
				AddEffAction->setText(QStringLiteral("Ôö¼ÓÌØЧ¹Ø¼üÖ¡"));
				QObject::connect(AddEffAction, SIGNAL(triggered()), this, SLOT(addEff()));
				popMenu->addAction(AddEffAction);
				popMenu->addSeparator();
			}
			if (Is_AttFra || Is_InjFra || Is_ActFra || Is_BodyFra || Is_EffFra)
			{
				DeleteAllAction = new QAction(this);
				DeleteAllAction->setObjectName(QStringLiteral("mydeleteAction"));
				DeleteAllAction->setText(QStringLiteral("ɾ³ýËùÓйؼüÖ¡"));
				QObject::connect(DeleteAllAction, SIGNAL(triggered()), this, SLOT(deleteFra()));
				popMenu->addAction(DeleteAllAction);
			}

			//else if (!(Is_AttFra && Is_InjFra && Is_ActFra && Is_BodyFra))
			//{
			//	AddAllAction = new QAction(this);
			//	AddAllAction->setObjectName(QStringLiteral("mydeleteAction"));
			//	AddAllAction->setText(QStringLiteral("Ôö¼ÓËùÓйؼüÖ¡"));
			//	QObject::connect(AddAllAction, SIGNAL(triggered()), this, SLOT(addFra()));
			//	popMenu->addAction(AddAllAction);
			//}
			popMenu->setStyleSheet("QMenu{background-color:rgb(255,255,255);color:rgb(0, 0, 0);font:10pt ""ËÎÌå"";}"
				"QMenu::item:selected{background-color:#CCDAE7;}");
			popMenu->exec(QCursor::pos());
		}

	}
	else
	{
		//ÆäËûµÄ·µ»Ø¸¸ÀàʹÓÃ
		__super::mousePressEvent(e);
	}
}
コード例 #9
0
void NodeGraphDisplay::addConnection(NodeControl *from_nc, NodeControl *to_nc, NCID from_id, NCID to_id)
{
	NodeConnectionControl *ncc = new NodeConnectionControl(this, from_nc, to_nc, from_id, to_id);
	connections.push_back(ncc);
	addBody(ncc);
}
コード例 #10
0
void NodeGraphDisplay::addNode(Node *n, Point2f graph_pos)
{
	NodeControl *nc = new NodeControl(this, n, graph_pos);
	nodeControls.push_back(nc);
	addBody(nc);
}
コード例 #11
0
ファイル: phyMgr.cpp プロジェクト: vinceplusplus/z3D
		void						phyMgr::parseUserText(const wcs& node_name, const SPtr<z3D::SG::SNode>& node, const wcs& user_text)
		{
			Config* cfg = Config::fromWCS(user_text);
			if(cfg->exists(L"collision_shape"))
			{
				wcs shape_name = cfg->getWString(L"collision_shape");
				REAL mass = cfg->getFloat(L"mass");
				int32_t compound = cfg->getInt32(L"compound");

				if(shape_name == L"box")
				{
					if(compound)
					{
						SPtr<phyShape> shape = createCompoundWrappedBoxShape(node->local_bound().extent(), node->local_bound().center());
						SPtr<phyBody> body = createBody(node, shape, Mat4::identity, mass, false);
						addBody(body);

						node->setPhyBody(body);
					}
					else
					{
						SPtr<phyShape> shape = createBoxShape(node->local_bound().extent());
						SPtr<phyBody> body = createBody(node, shape, Mat4::translation(Vec3(node->local_bound().center())), mass, false);
						addBody(body);

						node->setPhyBody(body);
					}
				}
				else if(shape_name == L"sphere")
				{
					Vec3 ext = node->local_bound().extent();
					SPtr<phyShape> shape = createSphereShape((ext[0] + ext[1] + ext[2]) / 3);
					SPtr<phyBody> body = createBody(node, shape, Mat4::translation(Vec3(node->local_bound().center())), mass, false);
					addBody(body);

					node->setPhyBody(body);
				}
				else if(shape_name == L"mesh")
				{
					if(node->type_info()->kind_of(z3D::SG::SMeshNode::type_info_static()))
					{
						SPtr<phyShape> shape = createMeshShape(node.cast<z3D::SG::SMeshNode>()->mesh());
						SPtr<phyBody> body = createBody(node, shape, Mat4::identity, mass, true);
						addBody(body);

						node->setPhyBody(body);
					}
				}
				else if(shape_name == L"convex_hull")
				{
					if(node->type_info()->kind_of(z3D::SG::SMeshNode::type_info_static()))
					{
						Vec3 offset;
						REAL computed_mass;
						Mat3 inertia_tensor;
						SPtr<phyShape> shape = createConvexHullShape(node.cast<z3D::SG::SMeshNode>()->mesh(), offset, computed_mass, inertia_tensor);
						SPtr<phyBody> body = createBody(node, shape, Mat4::translation(offset), mass, mass / computed_mass * Vec3(inertia_tensor[0][0], inertia_tensor[1][1], inertia_tensor[2][2]));

						addBody(body);

						node->setPhyBody(body);
					}
				}
				else if(shape_name == L"convex_decomp")
				{
					if(node->type_info()->kind_of(z3D::SG::SMeshNode::type_info_static()))
					{
						Vec3 offset;
						REAL computed_mass;
						Mat3 inertia_tensor;
						SPtr<phyShape> shape = createDecompConvexHullShape(node.cast<z3D::SG::SMeshNode>()->mesh(), offset, computed_mass, inertia_tensor);
						SPtr<phyBody> body = createBody(node, shape, Mat4::translation(offset), mass, mass / computed_mass * Vec3(inertia_tensor[0][0], inertia_tensor[1][1], inertia_tensor[2][2]));

						addBody(body);

						node->setPhyBody(body);
					}
				}
			}
			delete cfg;
		}
コード例 #12
0
ファイル: BulletCHOP.cpp プロジェクト: initialfx/BulletCHOP
void BulletCHOP::execute(const CHOP_Output* output,
								const CHOP_InputArrays* inputs,
								void* reserved)
{
	myExecuteCount++;

	dynamicsWorld->setGravity(btVector3(inputs->floatInputs[1].values[0],inputs->floatInputs[1].values[1],inputs->floatInputs[1].values[2]));
	
	// In this case we'll just take the first input and re-output it with it's
	// value divivded by two
	if (inputs->numCHOPInputs > 0)
	{
		
		

		if(inputs->floatInputs[0].values[0] == 1) {

			removeBodies();
			
			for (int i = 0; i < inputs->CHOPInputs[0].length; i++){
			
				output->channels[0][i] = inputs->CHOPInputs[0].channels[0][i];
				output->channels[1][i] = inputs->CHOPInputs[0].channels[1][i];
				output->channels[2][i] = inputs->CHOPInputs[0].channels[2][i];
				output->channels[3][i] = inputs->CHOPInputs[0].channels[3][i];
				output->channels[4][i] = inputs->CHOPInputs[0].channels[4][i];
				output->channels[5][i] = inputs->CHOPInputs[0].channels[5][i];
				output->channels[6][i] = inputs->CHOPInputs[0].channels[6][i];
				output->channels[7][i] = inputs->CHOPInputs[0].channels[7][i];
				output->channels[8][i] = inputs->CHOPInputs[0].channels[8][i];

				output->channels[9][i] = 0;
				//output->channels[10][i] = 0;
				//output->channels[11][i] = 0;

				btVector3 pos = btVector3(
								inputs->CHOPInputs[0].channels[0][i],
								inputs->CHOPInputs[0].channels[1][i],
								inputs->CHOPInputs[0].channels[2][i]);

				btVector3 rot = 0.017453*btVector3(
								inputs->CHOPInputs[0].channels[3][i],
								inputs->CHOPInputs[0].channels[4][i],
								inputs->CHOPInputs[0].channels[5][i]);

				btVector3 scale = btVector3(
								inputs->CHOPInputs[0].channels[6][i],
								inputs->CHOPInputs[0].channels[7][i],
								inputs->CHOPInputs[0].channels[8][i]);

				addBody(pos, rot, scale, 1);

				
			}
			for (int i = 0; i < inputs->CHOPInputs[1].length; i++){
			
				btVector3 pos = btVector3(
								inputs->CHOPInputs[1].channels[0][i],
								inputs->CHOPInputs[1].channels[1][i],
								inputs->CHOPInputs[1].channels[2][i]);

				btVector3 rot = 0.017453*btVector3(
								inputs->CHOPInputs[1].channels[3][i],
								inputs->CHOPInputs[1].channels[4][i],
								inputs->CHOPInputs[1].channels[5][i]);

				btVector3 scale = btVector3(
								inputs->CHOPInputs[1].channels[6][i],
								inputs->CHOPInputs[1].channels[7][i],
								inputs->CHOPInputs[1].channels[8][i]);

				addBody(pos, rot, scale, 0);

				
			}
			//addPlane(btVector3(0,0,0),btVector3(0,0,0));
		
		} else {

			//dynamicsWorld->stepSimulation(1.f/60.f,10);

			ms = getDeltaTimeMicroseconds() / 1000000.f;
			//ms = 1.4;
			dynamicsWorld->stepSimulation(ms,inputs->floatInputs[0].values[2],1.f/inputs->floatInputs[0].values[1]);
			//dynamicsWorld->stepSimulation(ms,10);
			//dynamicsWorld->stepSimulation(ms,inputs->floatInputs[0].values[2]);

			//dynamicsWorld->stepSimulation(1.0f/60.0f,10);

			if (dynamicsWorld->getNumCollisionObjects()!=0) {

			for (int i = 0; i < inputs->CHOPInputs[0].length; i++){

				btCollisionObject* obj = dynamicsWorld->getCollisionObjectArray()[i];
				btRigidBody* body = btRigidBody::upcast(obj);

				btTransform trans;
				body->getMotionState()->getWorldTransform(trans);
	
				output->channels[0][i] = float(trans.getOrigin().getX());
				output->channels[1][i] = float(trans.getOrigin().getY());
				output->channels[2][i] = float(trans.getOrigin().getZ());

				btScalar rotX, rotY, rotZ;

				trans.getBasis().getEulerZYX(rotX,rotY,rotZ);

				output->channels[3][i] = float(rotX)*57.2958;
				output->channels[4][i] = float(rotY)*57.2958;
				output->channels[5][i] = float(rotZ)*57.2958;

				output->channels[6][i] = inputs->CHOPInputs[0].channels[6][i];
				output->channels[7][i] = inputs->CHOPInputs[0].channels[7][i];
				output->channels[8][i] = inputs->CHOPInputs[0].channels[8][i];

				btVector3 vel = body->getLinearVelocity();

				output->channels[9][i] = pow(vel.x(),2)+pow(vel.y(),2)+pow(vel.z(),2);
				//output->channels[10][i] = 0;
				//output->channels[11][i] = 0;

			}

			for (int i = 0; i < inputs->CHOPInputs[1].length; i++){

				
				btCollisionObject* obj = dynamicsWorld->getCollisionObjectArray()[i+inputs->CHOPInputs[0].length];
				btRigidBody* body = btRigidBody::upcast(obj);

				btVector3 pos = btVector3(
								inputs->CHOPInputs[1].channels[0][i],
								inputs->CHOPInputs[1].channels[1][i],
								inputs->CHOPInputs[1].channels[2][i]);

				btVector3 rot = 0.017453*btVector3(
								inputs->CHOPInputs[1].channels[3][i],
								inputs->CHOPInputs[1].channels[4][i],
								inputs->CHOPInputs[1].channels[5][i]);

				btTransform trans;
				
				trans.setOrigin(pos);

				btMatrix3x3 rotMat;
				rotMat.setEulerZYX(rot.x(),rot.y(),rot.z());
	
				trans.setBasis(rotMat);

				body->getMotionState()->setWorldTransform(trans);

			}

			}

		}
		


	}
	else // If not input is connected, lets output a sine wave instead
	{
		
	}
}