Planet
navi homePPSaboutscreenshotsdownloaddevelopmentforum

Changeset 9456 in orxonox.OLD for branches


Ignore:
Timestamp:
Jul 25, 2006, 3:36:43 PM (18 years ago)
Author:
bensch
Message:

TurbineHover Syncable… the camera was the evil force here

File:
1 edited

Legend:

Unmodified
Added
Removed
  • branches/proxy/src/world_entities/space_ships/turbine_hover.cc

    r8623 r9456  
    126126  this->cameraNode.addNodeFlags(PNODE_PROHIBIT_CHILD_DELETE);
    127127  //this->cameraNode.setParentMode(PNODE_ROTATE_MOVEMENT);
    128   //this->cameraNode.setParent(this);
     128  this->cameraNode.setParent(this);
     129  this->cameraNode.setRelCoor(0,5,0);
    129130
    130131  // rotors
     
    211212  this->getWeaponManager().getFixedTarget()->setParent(&this->cameraNode);
    212213  this->getWeaponManager().getFixedTarget()->setRelCoor(1000,0,0);
    213  
     214
    214215  registerVar( new SynchronizeableBool( &bForward, &bForward, "bForward", PERMISSION_OWNER ) );
    215216  registerVar( new SynchronizeableBool( &bBackward, &bBackward, "bBackward", PERMISSION_OWNER ) );
     
    218219  registerVar( new SynchronizeableBool( &bAscend, &bAscend, "bAscend", PERMISSION_OWNER ) );
    219220  registerVar( new SynchronizeableBool( &bDescend, &bDescend, "bDescend", PERMISSION_OWNER ) );
    220   //registerVar( new SynchronizeableQuaternion( &direction, &direction, "direction", PERMISSION_OWNER ) );
     221  registerVar( new SynchronizeableQuaternion( &direction, &direction, "direction", PERMISSION_OWNER ) );
    221222  registerVar( new SynchronizeableFloat( &cameraLook, &cameraLook, "cameraLook", PERMISSION_OWNER ) );
    222223  registerVar( new SynchronizeableFloat( &rotation, &rotation, "rotation", PERMISSION_OWNER ) );
     
    298299
    299300  // TRYING TO FIX PNode.
    300   this->cameraNode.setAbsCoorSoft(this->getAbsCoor() + Vector(0.0f, 5.0f, 0.0f), 30.0f);
    301   this->cameraNode.setRelDirSoft(this->getAbsDir(), 30.0f);
    302 }
     301  //this->cameraNode.setAbsCoor(this->getAbsCoor() + Vector(0.0f, 5.0f, 0.0f));//, 30.0f);
     302  //this->cameraNode.setAbsDir(this->getAbsDir());//, 30.0f);
     303}
     304
     305
     306#include "shared_network_data.h"
    303307
    304308/**
     
    349353
    350354        this->velocity += (accelerationDir - damping)* dt;
    351         this->shiftCoor (this->velocity * dt);
     355        //if (this->getOwner() != SharedNetworkData::getInstance()->getHostID())
     356          this->shiftCoor (this->velocity * dt);
    352357
    353358        // limit the maximum rotation speed.
     
    362367        }
    363368
    364         this->setRelDirSoft(this->direction * Quaternion(-cameraLook, Vector(0,0,1)), 5);
     369        //if (this->getOwner() != SharedNetworkData::getInstance()->getHostID())
     370          this->setRelDirSoft(this->direction * Quaternion(-cameraLook, Vector(0,0,1)), 5);
    365371
    366372        this->wingNodeLeft.setRelDirSoft(Quaternion(accel.z * .05 +this->rotation, Vector(1,0,0)), 5);
     
    407413
    408414    case Playable::Vertical:
    409     {
    410       accel.z = 0;
    411       Vector accelerationDir = this->getAbsDir().apply(accel * this->acceleration);
    412       accelerationDir.z=0;
     415      {
     416        accel.z = 0;
     417        Vector accelerationDir = this->getAbsDir().apply(accel * this->acceleration);
     418        accelerationDir.z=0;
    413419
    414420        // this is the air friction (necessary for a smooth control)
    415       Vector damping = (this->velocity * this->airFriction);
    416 
    417       this->velocity += (accelerationDir - damping)* dt;
    418       this->shiftCoor (this->velocity * dt);
    419 
    420       this->setRelDirSoft(this->direction * Quaternion(-cameraLook, Vector(0,0,1)), 5);
    421 
    422       this->wingNodeLeft.setRelDirSoft(Quaternion(accel.z * .05 +this->rotation, Vector(1,0,0)), 5);
    423       this->rotorNodeLeft.setRelDirSoft(Quaternion(-accel.x * .07+this->rotation + cameraLook, Vector(0,0,1)), 5);
    424 
    425       this->wingNodeRight.setRelDirSoft(Quaternion(accel.z * .05 +this->rotation, Vector(1,0,0)), 5);
    426       this->rotorNodeRight.setRelDirSoft(Quaternion(-accel.x*.07 -this->rotation + cameraLook, Vector(0,0,1)), 5);
    427     }
    428     break;
     421        Vector damping = (this->velocity * this->airFriction);
     422
     423        this->velocity += (accelerationDir - damping)* dt;
     424        this->shiftCoor (this->velocity * dt);
     425
     426        this->setRelDirSoft(this->direction * Quaternion(-cameraLook, Vector(0,0,1)), 5);
     427
     428        this->wingNodeLeft.setRelDirSoft(Quaternion(accel.z * .05 +this->rotation, Vector(1,0,0)), 5);
     429        this->rotorNodeLeft.setRelDirSoft(Quaternion(-accel.x * .07+this->rotation + cameraLook, Vector(0,0,1)), 5);
     430
     431        this->wingNodeRight.setRelDirSoft(Quaternion(accel.z * .05 +this->rotation, Vector(1,0,0)), 5);
     432        this->rotorNodeRight.setRelDirSoft(Quaternion(-accel.x*.07 -this->rotation + cameraLook, Vector(0,0,1)), 5);
     433      }
     434      break;
    429435    default:
    430436      PRINTF(2)("Playmode %s Not Implemented\n", Playable::playmodeToString(this->getPlaymode()).c_str());
Note: See TracChangeset for help on using the changeset viewer.