我正在使用Open Dynamics Engine在C++中編寫遊戲。當我運行它,我得到這些錯誤:慣性必須是肯定的
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]
我有這樣的代碼:
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);
}
我被physics->addObject(&orb.body, &orb.mass, 1.0);
調用它。
我更新了第一篇文章。 – m4tx
是的,但是...是的,但是......它是什麼? – TonyK
Ahhh ...大聲笑,沒什麼,我只是在Orb類中創建了一個變量:'class Orb {public:[......] dMass mass; }'然後我在創建Orb和Physics對象後調用addObject()。 – m4tx