Skip to content

Commit

Permalink
pieces should be right beneath the finger
Browse files Browse the repository at this point in the history
  • Loading branch information
plattenschieber committed Jan 22, 2015
1 parent 9ce10ad commit cf83049
Showing 1 changed file with 8 additions and 5 deletions.
13 changes: 8 additions & 5 deletions hscgv_uebung_2/Grabber.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -79,9 +79,9 @@ Grabber::setPiece(SbVec3f position)
// Schedule the idle sensor for the animation!
// During the animation Gameboard::setPiece is called.

m_gameboard->setPiece(m_pickedUpTile->getChild(0));
m_pickedUpTile->getChild(0)->unref();
m_pickedUpTile->removeChild(0);
m_gameboard->setPiece(m_pickedUpTile->getChild(1));
m_pickedUpTile->getChild(1)->unref();
m_pickedUpTile->removeChild(1);
// remember to drop down a piece
// m_mode = SET_PIECE;
}
Expand Down Expand Up @@ -214,7 +214,7 @@ Grabber::initSceneGraph()
movingGrabber->addChild(armGroup);
SoTransform *armTrafo = new SoTransform;
armTrafo->translation.setValue(.0,.0,4.0);
armTrafo->rotation.setValue(SbVec3f(0,0,1), 3*M_PI_4);
armTrafo->rotation.setValue(SbVec3f(0,0,1), M_PI);
armGroup->addChild(armTrafo);
SoCube *arm = new SoCube;
arm->width = arm->height = 1.5;
Expand All @@ -228,7 +228,7 @@ Grabber::initSceneGraph()
// translate elbow to top of shoulder + its own half height (=radius)
// [all heigths of any SoObjects are measured from their midpoints]
elbowTrafo->translation.setValue(.0,.0,arm->depth.getValue()/2+.75);
elbowTrafo->rotation.setValue(SbVec3f(0,1,0), M_PI_4);
elbowTrafo->rotation.setValue(SbVec3f(0,1,0), 0.);
elbowGroup->addChild(elbowTrafo);
SoCylinder *elbow = new SoCylinder;
elbow->radius = 1.;
Expand Down Expand Up @@ -312,6 +312,9 @@ Grabber::initSceneGraph()
// and lust but not leaster ;) - we need a place for the picked up tile
m_pickedUpTile = new SoGroup;
movingGrabber->addChild(m_pickedUpTile);
SoTransform *tileTrafo = new SoTransform;
tileTrafo->translation.setValue(.0,.625,-1.5);
m_pickedUpTile->addChild(tileTrafo);

// build remaining parts of grabber
return grabber;
Expand Down

0 comments on commit cf83049

Please sign in to comment.