2

I'm writing a game in C++ using Open Dynamics Engine. When I run it, i get these errors:

ODE Message 2: inertia must be positive definite in dMassCheck() File ../../../../../ode/src/mass.cpp Line 53

ODE Message 2: inertia must be positive definite in dMassCheck() File ../../../../../ode/src/mass.cpp Line 53

ODE INTERNAL ERROR 1: assertion "dMassCheck(mass)" failed in dBodySetMass() [../../../../../ode/src/ode.cpp]

I have this code:

void Physics::addObject(dBodyID *body, dMass *massPtr, dReal mass) {
    *body = dBodyCreate(world);
    dMassSetSphereTotal(massPtr, 2.0f, 1.0f);
    dBodySetMass(*body, massPtr);
    dBodySetPosition(*body, 0.0, 0.0, 0.0);
}

I'm calling it by physics->addObject(&orb.body, &orb.mass, 1.0);.

Rasman
  • 5,349
  • 1
  • 25
  • 38
m4tx
  • 4,139
  • 5
  • 37
  • 61

1 Answers1

0

The massPtr structure contains an inertia tensor. This tensor (just a matrix, in this context) has to be positive definite. That's all we can say until you tell us where you got your massPtr from.

TonyK
  • 16,761
  • 4
  • 37
  • 72
  • Ahhh... Lol, nothing, i just created a variable in Orb class: `class Orb { public: [...] dMass mass; }` And then i'm calling addObject() after creating Orb and Physics objects. – m4tx Sep 02 '11 at 14:52
  • Heavens, isn't it obvious? You have to initialise `massPtr` with a valid inertia tensor. Like the error messages told you. – TonyK Sep 02 '11 at 15:27