Planet
navi homePPSaboutscreenshotsdownloaddevelopmentforum

Ignore:
Timestamp:
Dec 13, 2008, 11:18:44 PM (15 years ago)
Author:
rgrieder
Message:

Added XML Parameters for restitution, angular factor, linear damping, angular damping and friction to WorldEntity.

File:
1 edited

Legend:

Unmodified
Added
Removed
  • code/branches/physics/src/orxonox/objects/worldentities/WorldEntity.h

    r2426 r2429  
    141141
    142142        private:
    143             void updateParent();
    144 
    145143            inline void lookAt_xmlport(const Vector3& target)
    146144                { this->lookAt(target); }
     
    154152                { this->roll(angle); }
    155153
     154            // network callbacks
     155            void parentChanged();
    156156            inline void scaleChanged()
    157157                { this->setScale3D(this->getScale3D()); }
     
    192192            std::string getCollisionTypeStr() const;
    193193
    194             void setMass(float mass);
     194            inline void setMass(float mass)
     195                { this->mass_ = mass; recalculateMassProps(); }
    195196            inline float getMass() const
    196197                { return this->mass_; }
     198
    197199            inline float getTotalMass() const
    198200                { return this->mass_ + this->childrenMass_; }
     201
     202            inline void setRestitution(float restitution)
     203                { this->restitution_ = restitution; resetPhysicsProps(); }
     204            inline float getRestitution() const
     205                { return this->restitution_; }
     206
     207            inline void setAngularFactor(float angularFactor)
     208                { this->angularFactor_ = angularFactor; resetPhysicsProps(); }
     209            inline float getAngularFactor() const
     210                { return this->angularFactor_; }
     211
     212            inline void setLinearDamping(float linearDamping)
     213                { this->linearDamping_ = linearDamping; resetPhysicsProps(); }
     214            inline float getLinearDamping() const
     215                { return this->linearDamping_; }
     216
     217            inline void setAngularDamping(float angularDamping)
     218                { this->angularDamping_ = angularDamping; resetPhysicsProps(); }
     219            inline float getAngularDamping() const
     220                { return this->angularDamping_; }
     221
     222            inline void setFriction(float friction)
     223                { this->friction_ = friction; resetPhysicsProps(); }
     224            inline float getFriction() const
     225                { return this->friction_; }
    199226
    200227            void attachCollisionShape(CollisionShape* shape);
     
    217244        private:
    218245            void updateCollisionType();
    219             void recalculatePhysicsProps();
     246            void recalculateMassProps();
     247            void resetPhysicsProps();
    220248
    221249            // network callbacks
    222250            void collisionTypeChanged();
    223             void massChanged();
    224251            void physicsActivityChanged();
     252            inline void massChanged()
     253                { this->setMass(this->mass_); }
     254            inline void restitutionChanged()
     255                { this->setRestitution(this->restitution_); }
     256            inline void angularFactorChanged()
     257                { this->setAngularFactor(this->angularFactor_); }
     258            inline void linearDampingChanged()
     259                { this->setLinearDamping(this->linearDamping_); }
     260            inline void angularDampingChanged()
     261                { this->setAngularDamping(this->angularDamping_); }
     262            inline void frictionChanged()
     263                { this->setFriction(this->friction_); }
    225264
    226265            CollisionType                collisionType_;
     
    230269            CompoundCollisionShape*      collisionShape_;
    231270            btScalar                     mass_;
     271            btScalar                     restitution_;
     272            btScalar                     angularFactor_;
     273            btScalar                     linearDamping_;
     274            btScalar                     angularDamping_;
     275            btScalar                     friction_;
    232276            btScalar                     childrenMass_;
    233277    };
Note: See TracChangeset for help on using the changeset viewer.