Planet
navi homePPSaboutscreenshotsdownloaddevelopmentforum

Ignore:
Timestamp:
Jun 15, 2007, 4:44:51 PM (17 years ago)
Author:
rennerc
Message:

fpsweapon in the correct position

Location:
branches/presentation/src/world_entities/creatures
Files:
2 edited

Legend:

Unmodified
Added
Removed
  • branches/presentation/src/world_entities/creatures/fps_player.cc

    r10704 r10705  
    109109  this->jumpAcceleration = 0.0f;
    110110
    111   this->cameraNode.setParent(this);
     111  this->cameraNode = new PNode();
     112  this->cameraNode->setParent(this);
    112113
    113114  this->attitude = this->getAbsDir().getAttitude();
     
    133134  //this->aimingSystem = new AimingSystem(this);
    134135
    135 #if 0
     136#if 1
    136137  this->getWeaponManager().changeWeaponConfig(1);
    137138  this->getWeaponManager().setSlotCount(2);
     
    142143  this->getWeaponManager().setSlotPosition(1, Vector(5.0, 0.0, 0.0));
    143144
    144   this->getWeaponManager().setParentNode(&this->cameraNode);
    145   this->cameraNode.addNodeFlags(PNODE_PROHIBIT_CHILD_DELETE);
    146 
    147   this->getWeaponManager().getFixedTarget()->setParent(&this->cameraNode);
     145  this->getWeaponManager().setParentNode(this->cameraNode);
     146  this->cameraNode->addNodeFlags(PNODE_PROHIBIT_CHILD_DELETE);
     147
     148  this->getWeaponManager().getFixedTarget()->setParent(this->cameraNode);
    148149  this->getWeaponManager().getFixedTarget()->setParentMode(PNODE_ALL);
    149150  this->getWeaponManager().getFixedTarget()->setRelCoor(10,0,0);
     
    155156    this->addWeapon(wpRight,1, 0);
    156157    wpRight->toList( this->getOMListNumber() );
    157     wpRight->setParent( &this->cameraNode );
    158     wpRight->requestAction( WA_ACTIVATE );
     158    wpRight->setParent( this->cameraNode );
     159    //wpRight->requestAction( WA_ACTIVATE );
    159160    //wpRight->addChild(this->aimingSystem);
    160161
    161162    //this->toList( OM_PLAYERS );
    162163  }
    163 #endif
     164#else
    164165                         
    165166  FPSSniperRifle* wpRight = new FPSSniperRifle(0);
     
    169170 
    170171  this->weaponMan.setParentEntity( this );
    171   this->weaponMan.setSlotCount(1);
    172   this->weaponMan.createWeaponSlot(0, this->cameraNode.getRelCoor().x, this->cameraNode.getRelCoor().y, this->cameraNode.getRelCoor().z, WTYPE_ALLDIRS | WTYPE_DIRECTIONAL);
     172  this->weaponMan.setSlotCount(2);
     173  this->weaponMan.createWeaponSlot(0, 0, 0, 0, WTYPE_ALLDIRS | WTYPE_DIRECTIONAL);
     174  this->weaponMan.createWeaponSlot(1, 0, 0, 0, WTYPE_ALLDIRS | WTYPE_DIRECTIONAL);
    173175  this->weaponMan.addWeapon(wpRight, 0, 0);
    174176  this->weaponMan.changeWeaponConfig(0);
     
    176178  this->weaponMan.getFixedTarget()->setParent(&this->cameraNode );
    177179  this->weaponMan.getFixedTarget()->setRelCoor( 100000,0,0 );
    178 
     180#endif
    179181
    180182  // network registration
     
    240242  dynamic_cast<Element2D*>(this->getWeaponManager().getFixedTarget())->setVisibility( true );
    241243
    242   State::getCameraNode()->setParentSoft(&this->cameraNode);
    243   State::getCameraTargetNode()->setParentSoft(&this->cameraNode);
     244  State::getCameraNode()->setParentSoft(this->cameraNode);
     245  State::getCameraTargetNode()->setParentSoft(this->cameraNode);
    244246 
    245247  State::getCamera()->setViewMode(Camera::ViewFPS);
    246248 
    247   this->getWeaponManager().getFixedTarget()->setParent(&this->cameraNode);
     249  this->getWeaponManager().getFixedTarget()->setParent(this->cameraNode);
    248250  //this->getWeaponManager().getFixedTarget()->setParentMode(PNODE_ALL);
    249251  //this->getWeaponManager().getFixedTarget()->setRelCoor(100,0,0);
     
    278280    this->initWeapon = true;
    279281
    280     this->cameraNode.setParentMode(PNODE_ROTATE_AND_MOVE);
     282    this->cameraNode->setParentMode(PNODE_ROTATE_AND_MOVE);
    281283
    282284    this->getWeaponManager().getParentNode()->setParentMode(PNODE_ROTATE_AND_MOVE);
    283     this->getWeaponManager().getFixedTarget()->setParent(&this->cameraNode);
     285    this->getWeaponManager().getFixedTarget()->setParent(this->cameraNode);
    284286    //this->getWeaponManager().getFixedTarget()->setParentMode(PNODE_ROTATE_AND_MOVE);
    285287    State::getCamera()->setViewMode(Camera::ViewFPS);
     
    298300          f = 0.3*f;
    299301     
    300       this->cameraNode.setRelCoor(0, box->halfLength[1] * f, 0);
     302      this->cameraNode->setRelCoor(0, box->halfLength[1] * f, 0);
     303//      this->weaponMan.setRelCoor(0, box->halfLength[1] * f, 0);
    301304//      this->cameraNode.setRelCoor(10, box->halfLength[1] * f, 0);
    302305     float v = 0.1f;
    303      this->getWeaponManager().setSlotPosition(0, Vector(-8.0, box->halfLength[1] * v, 1.1));
    304      this->getWeaponManager().setSlotPosition(1, Vector(5.0, box->halfLength[1] * v, 0.0));
     306     //this->getWeaponManager().setSlotPosition(0, Vector(-8.0, box->halfLength[1] * v, 1.1));
     307     //this->getWeaponManager().setSlotPosition(1, Vector(5.0, box->halfLength[1] * v, 0.0));
     308     this->getWeaponManager().setSlotDirection( 0, Quaternion( 0.04, Vector( 0, 0, 1 ) ) );
    305309  }
    306310 
     
    390394
    391395  this->setAbsDir(Quaternion(heading, Vector(0,1,0)));
    392   this->cameraNode.setRelDir(Quaternion( attitude, Vector( 0, 0, 1 ) ));
     396  this->cameraNode->setRelDir(Quaternion( attitude, Vector( 0, 0, 1 ) ));
    393397
    394398  Vector velocity;
  • branches/presentation/src/world_entities/creatures/fps_player.h

    r10704 r10705  
    6262    float                 attitude;          //!< defines the camera angle to the x-z-plane
    6363
    64     PNode                 cameraNode;        //!< the "eyes" of the player (or call it head if you want)
     64    PNode*                cameraNode;        //!< the "eyes" of the player (or call it head if you want)
    6565
    6666    float                 fallVelocity;      //!< velocity for falling down
Note: See TracChangeset for help on using the changeset viewer.