Planet
navi homePPSaboutscreenshotsdownloaddevelopmentforum

Changeset 6143


Ignore:
Timestamp:
Nov 25, 2009, 1:42:38 PM (14 years ago)
Author:
wirthmi
Message:

updateTarget() fixed

File:
1 edited

Legend:

Unmodified
Added
Removed
  • code/branches/presentation2/src/orxonox/controllers/NewHumanController.cc

    r6122 r6143  
    135135        }
    136136*/
    137         if( !NewHumanController::localController_s->getControllableEntity()->isInMouseLook() )
    138             this->updateTarget();
    139 
    140         HumanController::localController_s->getControllableEntity()->fire(firemode);
     137
     138        if (firemode == 1 && this->controlMode_ == 1) {
     139            //unlocked steering, steer on right mouse click
     140            //HumanController::yaw(new Vector2(this->currentYaw_, 0));
     141            //HumanController::pitch(new Vector2(this->currentPitch_, 0));
     142        }
     143        else {
     144            if( !NewHumanController::localController_s->getControllableEntity()->isInMouseLook() )
     145                this->updateTarget();
     146
     147            HumanController::localController_s->getControllableEntity()->fire(firemode);
     148        }
     149
    141150    }
    142151
     
    190199                        continue;
    191200                }
    192                
    193                 if( this->getControllableEntity()->getTarget() != wePtr )
     201
     202                if ( this->getControllableEntity() && this->getControllableEntity()->getTarget() != wePtr )
     203                {
    194204                    this->getControllableEntity()->setTarget(wePtr);
     205                }
     206
     207                if( pawn )
     208                {
     209                    pawn->setAimPosition( mouseRay.getOrigin() + mouseRay.getDirection() * itr->distance );
     210                }
    195211
    196212                itr->movable->getParentSceneNode()->showBoundingBox(true);
    197213                //std::cout << itr->movable->getParentSceneNode()->_getDerivedPosition() << endl;
    198214                //return mouseRay.getOrigin() + mouseRay.getDirection() * itr->distance; //or itr->movable->getParentSceneNode()->_getDerivedPosition()
    199                 if ( pawn )
    200                 {
    201                     pawn->setAimPosition( mouseRay.getOrigin() + mouseRay.getDirection() * itr->distance ); // or itr->movable->getParentSceneNode()->_getDerivedPosition()
    202                     pawn->setTarget( wePtr );
    203                 }
    204215                return;
    205216            }
     
    209220        {
    210221            pawn->setAimPosition( mouseRay.getOrigin() + mouseRay.getDirection() * 1200 );
    211             if( this->getControllableEntity()->getTarget() != 0 )
    212                 pawn->setTarget( 0 );
    213         }
     222        }
     223
     224        if( this->getControllableEntity() && this->getControllableEntity()->getTarget() != 0 )
     225            this->getControllableEntity()->setTarget( 0 );
    214226   
    215227
     
    223235        if (this->controlMode_ == 0)
    224236            HumanController::yaw(value);
    225        
     237
    226238        this->currentYaw_ = value.x;
    227         //std::cout << "Y: " << static_cast<float>(this->currentPitch_) << " X: " << static_cast<float>(this->currentYaw_) << endl;
    228239    }
    229240
     
    234245            HumanController::pitch(value);
    235246
     247std::cout << value << endl;
     248
    236249        this->currentPitch_ = value.x;
    237         //std::cout << "Y: " << static_cast<float>(this->currentPitch_) << " X: " << static_cast<float>(this->currentYaw_) << endl;
    238250    }
    239251
     
    247259            NewHumanController::localController_s->controlMode_ = 0;
    248260    }
    249    
     261
    250262    void NewHumanController::changedControllableEntity()
    251263    {
Note: See TracChangeset for help on using the changeset viewer.