我正在使用下面的代码在垂直轴上拖动精灵。但是使用MoveTo动作让精灵跟随触摸只会让它变得疯狂,虽然只是设置位置触摸位置工作正常。
//// Move Player
// Location
touchMovedLocation = ( touch -> getLocationInView() );
touchMovedLocation = ( this -> convertToNodeSpace(touchMovedLocation) );
// Translation
touchMovedLocation = Vec2(( lift -> getPosition().x ), touchMovedLocation.y);
touchMovedLocation = ( this -> boundLiftMovement(touchMovedLocation) );
// Move
auto action = MoveTo::create(0.2f, touchMovedLocation);
( lift -> runAction(action) );
//( lift -> setPosition(touchMovedLocation) );