ChinosInternationalCC/chinoPinball — pull request #98 by ovicin (2014-03-16 19:05:05+00:00)
Title: draft implementation of moving the object with the mouse

In the ScenarioEditor the following code was added.

```
//--------------------------------------------------------
void ScenarioEditor::mouseDragged(ofMouseEventArgs &args){
ofVec3f newPos;
if (selectedObject != NULL){

newPos = selectedObject->position;
newPos.x = newPos.x + (args.x/1000);
newPos.y = newPos.y + (args.y/1000);
selectedObject -> position = newPos;
selectedObject -> setPosition(newPos);
}
}
```

For the moment the new position is not calculated well because the object moves only in one direction.
The position is changed by calling SimpleObject::SetPosition that created a new rigid body.
We should see what is the impact of this
```
void Hammer::setPosition(ofVec3f position){

btTransform transform;
btRigidBody* rigidBody = body.getRigidBody();
rigidBody->getMotionState()->getWorldTransform( transform );
btVector3 origin;
origin.setX(position.x);
origin.setY(position.y);
origin.setZ(position.z);
transform.setOrigin(origin);
rigidBody->getMotionState()->setWorldTransform( transform );

}
```