Commits

Daniel K. O.  committed aee0231

more changes

  • Participants
  • Parent commits e95ece9

Comments (0)

Files changed (3)

File include/kode/Body.hpp

         const Vector3& getTotalTorque() const noexcept;
 
 
-        void attach(Geom& g);
-        void detach(Geom& g);
-
 
         void integrate(Real dt);
         void integrateVel(Real dt);
         Vector3 velAtLocalPoint(const Vector3& localPoint) const noexcept;
 
         inline
+        Vector3 velAtLocalPoint(Real localX, Real localY, Real localZ) const noexcept;
+
+        inline
         Vector3 velAtPoint(const Vector3& worldPoint) const noexcept;
 
         inline
+        Vector3 velAtPoint(Real worldX, Real worldY, Real worldZ) const noexcept;
+
+        inline
         Vector3 localVectorToWorld(const Vector3& localVector) const noexcept;
 
         inline
         // disabling
         void enable();
         void disable();
-        inline bool isEnabled() const noexcept;
+        inline
+        bool isEnabled() const noexcept;
 
         // damping
         inline
 
         // getters for navigation/serialization
         inline const std::vector<Joint*>& getJoints() const noexcept;
-        inline const std::vector<Geom*>& getGeoms() const noexcept;
 
 
+        void attach(Geom& g);
+        void detach(Geom& g);
+
+        inline
+        const std::vector<Geom*>& getGeoms() const noexcept;
+
+        inline
+        std::vector<Geom*>& getGeoms() noexcept;
+
         void fireBeforeStep();
         void fireMoved();
         void fireSolved();
         bool getAutoIdle() const noexcept;
 
         void enableAutoIdle() noexcept;
+        void disableAutoIdle() noexcept;
         void setIdleSteps(unsigned steps);
         void setIdleThreshold(Real linThreshold, Real angThreshold);
-        void disableAutoIdle() noexcept;
 
 
         inline

File include/kode/Body.inl

 
     inline
     Vector3
+    Body::velAtLocalPoint(Real localX, Real localY, Real localZ) const noexcept
+    {
+        return velAtLocalPoint({localX, localY, localZ});
+    }
+
+
+    inline
+    Vector3
     Body::velAtPoint(const Vector3& worldPoint) const noexcept
     {
         return getLinearVel() + cross(getAngularVel(), worldPoint - getCoM());
 
     inline
     Vector3
+    Body::velAtPoint(Real worldX, Real worldY, Real worldZ) const noexcept
+    {
+        return velAtPoint({worldX, worldY, worldZ});
+    }
+
+
+    inline
+    Vector3
     Body::localVectorToWorld(const Vector3& localVector) const noexcept
     {
         return getLocalAxes() * localVector;
         return params.angularDampingScale;
     }
 
+
     inline
     bool
     Body::hasWeight() const noexcept
 
 
     inline
+    std::vector<Geom*>&
+    Body::getGeoms() noexcept
+    {
+        return geoms;
+    }
+
+
+    inline
     bool
     Body::getAutoIdle() const noexcept
     {

File samples/KODEOgre/buggy.cpp

 using namespace kode::ogre;
 
 const Real stepSize = 0.03;
-const Real maxVel = 46;
-const Real maxForce = 1/16.;
+const Real maxVel = 75;
+const Real maxForce = 1/8.;
 const Real length = 2;
 const Real width = 1;
 const Real height = 0.3;
 const Real kd = 0.8;
 const Real suspCFM = 1/(stepSize*kp + kd);
 const Real suspERP = (stepSize*kp)/(stepSize*kp + kd);
-const Real jointCFM = 1e-5;
-const Real jointERP = 0.7;
+const Real jointCFM = 1e-6;
+const Real jointERP = 0.8;
 
 struct Demo : App {
     SimpleSpace space;
         chassis.setPosition(0, startHeight, 0);
         // tweak: lower the center of mass
         Mass m = chassis.getMass();
-        m.translate(0, -height/2, 0);
+        m.translate(0, -height, 0);
         chassis.setMass(m);
         space.add(chassis);
         world.add(chassis);
                                             c.setFDir1(b2->getOrientation().localZ());
                                     }
                                     c.setSlip(0.1, 0.1);
-                                    c.setMu(1.5);
+                                    c.setMu(2);
                                     c.setSoftERP(0.1);
                                     c.setSoftCFM(0.2);
                                     c.setRho(1e-3, 1e-3);