Esempio n. 1
0
PhysicsActor::~PhysicsActor() {
  btCollisionShape *collision_shape = rigid_body_->getCollisionShape();

  removeConstraints();
  delete rigid_body_->getMotionState();
  if (physics_enabled_) {
    removeActorFromDynamicsWorld();
  }
  delete rigid_body_;
  delete collision_shape;
}
Esempio n. 2
0
void PhysicsActor::set6DofConstraint(Ogre::Vector3 linear_lower_limit, Ogre::Vector3 linear_upper_limit,
                                     Ogre::Vector3 angular_lower_limit, Ogre::Vector3 angular_upper_limit) {
  removeConstraints();

  btTransform identity = btTransform::getIdentity();
  btTransform transform;
  transform.setIdentity();
  transform.setOrigin(rigid_body_->getWorldTransform().getOrigin());

  constraint_ = new btGeneric6DofConstraint(*rigid_body_, dummy_constraint_body_,
                                              identity, transform, false);

  constraint_->setAngularLowerLimit(toBt(angular_lower_limit));
  constraint_->setAngularUpperLimit(toBt(angular_upper_limit));
  constraint_->setLinearLowerLimit(toBt(linear_lower_limit));
  constraint_->setLinearUpperLimit(toBt(linear_upper_limit));

  if (physics_enabled_) {
    physics_->dynamics_world()->addConstraint(constraint_);
    constraint_is_added_ = true;
  }
}
Esempio n. 3
0
/**
 * Create and connect actions
 */
void FunctionBrowser::createActions()
{
  m_actionAddFunction = new QAction("Add function",this);
  connect(m_actionAddFunction,SIGNAL(triggered()),this,SLOT(addFunction()));

  m_actionRemoveFunction = new QAction("Remove function",this);
  connect(m_actionRemoveFunction,SIGNAL(triggered()),this,SLOT(removeFunction()));

  m_actionFixParameter = new QAction("Fix",this);
  connect(m_actionFixParameter,SIGNAL(triggered()),this,SLOT(fixParameter()));

  m_actionRemoveTie = new QAction("Remove tie",this);
  connect(m_actionRemoveTie,SIGNAL(triggered()),this,SLOT(removeTie()));

  m_actionAddTie = new QAction("Add tie",this);
  connect(m_actionAddTie,SIGNAL(triggered()),this,SLOT(addTie()));

  m_actionFromClipboard = new QAction("Copy from clipboard",this);
  connect(m_actionFromClipboard,SIGNAL(triggered()),this,SLOT(copyFromClipboard()));

  m_actionToClipboard = new QAction("Copy to clipboard",this);
  connect(m_actionToClipboard,SIGNAL(triggered()),this,SLOT(copyToClipboard()));

  m_actionConstraints = new QAction("Custom",this);
  connect(m_actionConstraints,SIGNAL(triggered()),this,SLOT(addConstraints()));

  m_actionConstraints10 = new QAction("10%",this);
  connect(m_actionConstraints10,SIGNAL(triggered()),this,SLOT(addConstraints10()));

  m_actionConstraints50 = new QAction("50%",this);
  connect(m_actionConstraints50,SIGNAL(triggered()),this,SLOT(addConstraints50()));

  m_actionRemoveConstraints = new QAction("Remove constraints",this);
  connect(m_actionRemoveConstraints,SIGNAL(triggered()),this,SLOT(removeConstraints()));

  m_actionRemoveConstraint = new QAction("Remove",this);
  connect(m_actionRemoveConstraint,SIGNAL(triggered()),this,SLOT(removeConstraint()));
}
Esempio n. 4
0
void sqlimport::processSQL(QStringList sqlLines)
{
    QString sqlStatement;
    int nlines;
    QString tablename;
    int temp,temp2;

    for (nlines = 0; nlines <= sqlLines.count()-1;nlines++)
    {
        sqlStatement = sqlStatement + sqlLines[nlines].simplified() + " ";
    }

    //qDebug() << sqlStatement;

    if ((sqlStatement.toUpper().contains("CREATE TABLE ")) ||
            (sqlStatement.toUpper().contains("CREATE  TABLE ")))
    {
        //qDebug() << "CREATE:" << sqlStatement;
        sqlStatement = cleanSQL(sqlStatement);

        temp = sqlStatement.indexOf(" TABLE ");
        temp2 = sqlStatement.indexOf("(");


        tablename = sqlStatement.mid(temp+7,temp2-temp-8);

        processKeyIndexes(tablename,sqlStatement,0);
        processIndexes(tablename,sqlStatement,0);
        if (translateConstraints)
        {
            processConstraints(tablename,sqlStatement,0);
        }

        if (translateConstraints)
        {
            setNULLToForeignKeys(tablename,sqlStatement);
        }


        sqlStatement = sqlStatement.replace(" unsigned "," ",Qt::CaseInsensitive);

        sqlStatement = removeIndexes(sqlStatement);

        if (translateConstraints)
        {
            sqlStatement = removeConstraints(sqlStatement);
        }

        sqlStatement = sqlStatement + "\n";
        //outfile.write(sqlStatement.toAscii());
        writeToFile(sqlStatement.toAscii());
    }
    else
    {
        if (processInserts == true)
        {
            //qDebug() << "INSERT:" << sqlStatement;
            //processInsert(sqlStatement,0,"");
            processInsert(sqlStatement);
        }
    }
}