Planet
navi homePPSaboutscreenshotsdownloaddevelopmentforum

Ignore:
Timestamp:
Nov 30, 2008, 12:36:46 PM (16 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/LinearEntity.cc

    r2292 r2300  
    4545        RegisterObject(LinearEntity);
    4646
    47         this->velocity_ = Vector3::ZERO;
    4847        this->acceleration_ = Vector3::ZERO;
    4948        this->rotationAxis_ = Vector3::ZERO;
     
    6564        SUPER(LinearEntity, XMLPort, xmlelement, mode);
    6665
    67         XMLPortParamTemplate(LinearEntity, "velocity", setVelocity, getVelocity, xmlelement, mode, const Vector3&);
    6866        XMLPortParamTemplate(LinearEntity, "rotationaxis", setRotationAxis, getRotationAxis, xmlelement, mode, const Vector3&);
    6967        XMLPortParamTemplate(LinearEntity, "rotationrate", setRotationRate, getRotationRate, xmlelement, mode, const Degree&);
     
    129127    void LinearEntity::positionChanged()
    130128    {
    131         this->overwrite_position_  = this->node_->getPosition();
     129        this->overwrite_position_  = this->getPosition();
    132130    }
    133131
    134132    void LinearEntity::orientationChanged()
    135133    {
    136         this->overwrite_orientation_  = this->node_->getOrientation();
    137     }
    138 
    139     void LinearEntity::setVelocity(const Vector3& velocity)
    140     {
    141         if (!this->isDynamic())
    142         {
    143             // no physics, we do it ourselves
    144             internalSetVelocity(velocity);
    145         }
    146         else
    147         {
    148             this->physicalBody_->setLinearVelocity(btVector3(velocity.x, velocity.y, velocity.z));
    149         }
     134        this->overwrite_orientation_  = this->getOrientation();
    150135    }
    151136}
Note: See TracChangeset for help on using the changeset viewer.