Planet
navi homePPSaboutscreenshotsdownloaddevelopmentforum

Ignore:
Timestamp:
Nov 30, 2008, 12:36:46 PM (17 years ago)
Author:
rgrieder
Message:

Still getting physics and its implications straight:

  • Removed PositionableEntity —> StaticEntity is now the way to go. They cannot be translated in any way during physics simulation. The trick will be to remove them and add them again to Bullet. This however is not yet implemented.
  • Forgot a few consts in WorldEntity
  • Fixed a bug with infinite masses
  • WE throws exception if you try to apply physics when the SceneNode is not in the root space of the Scene.
  • Moved velocity_ to MovableEntity
  • Outside world reference of WE/ME are now always the non-physical values. getPosition() will always return node_→getPosition() and when setting it, both RigidBody and SceneNode are translated. This accounts for velocity, orientation and position.
File:
1 edited

Legend:

Unmodified
Added
Removed
  • code/branches/physics/src/orxonox/objects/worldentities/ControllableEntity.cc

    r2292 r2300  
    5757        this->bDestroyWhenPlayerLeft_ = false;
    5858
    59         this->velocity_ = Vector3::ZERO;
    6059        this->acceleration_ = Vector3::ZERO;
    6160
     
    332331        if (Core::isMaster())
    333332        {
    334             this->server_position_ = this->node_->getPosition();
     333            this->server_position_ = this->getPosition();
    335334            ++this->server_overwrite_;
    336335        }
    337336        else if (this->bControlled_)
    338337        {
    339             this->client_position_ = this->node_->getPosition();
     338            this->client_position_ = this->getPosition();
    340339        }
    341340    }
     
    345344        if (Core::isMaster())
    346345        {
    347             this->server_orientation_ = this->node_->getOrientation();
     346            this->server_orientation_ = this->getOrientation();
    348347            ++this->server_overwrite_;
    349348        }
    350349        else if (this->bControlled_)
    351350        {
    352             this->client_orientation_ = this->node_->getOrientation();
     351            this->client_orientation_ = this->getOrientation();
    353352        }
    354353    }
     
    358357        if (Core::isMaster())
    359358        {
    360             this->server_velocity_ = this->velocity_;
     359            this->server_velocity_ = this->getVelocity();
    361360            ++this->server_overwrite_;
    362361        }
    363362        else if (this->bControlled_)
    364363        {
    365             this->client_velocity_ = this->velocity_;
    366         }
    367     }
    368 
    369     void ControllableEntity::setVelocity(const Vector3& velocity)
    370     {
    371         if (this->bControlled_ || Core::isMaster())
    372         {
    373             if (!this->isDynamic())
    374             {
    375                 // no physics, we do it ourselves
    376                 internalSetVelocity(velocity);
    377             }
    378             else
    379             {
    380                 this->physicalBody_->setLinearVelocity(btVector3(velocity.x, velocity.y, velocity.z));
    381             }
    382             velocityChanged();
     364            this->client_velocity_ = this->getVelocity();
    383365        }
    384366    }
Note: See TracChangeset for help on using the changeset viewer.