Moderators: Sascha Willems, Thomas
newtonMesh_ = physicsWorld_->GetCreateNewtonMesh(meshKey);
NewtonMeshBeginBuild(newtonMesh_->mesh);
for ( each triangle with vertices (v1,v2,v3) )
{
NewtonMeshBeginFace(newtonMesh_->mesh);
NewtonMeshAddPoint(newtonMesh_->mesh, v1.x_, v1.y_, v1.z_);
NewtonMeshAddPoint(newtonMesh_->mesh, v2.x_, v2.y_, v2.z_);
NewtonMeshAddPoint(newtonMesh_->mesh, v3.x_, v3.y_, v3.z_);
NewtonMeshEndFace(newtonMesh_->mesh);
}
NewtonMeshEndBuild(newtonMesh_->mesh);
void dgBody::SetMassMatrix(dgFloat32 mass, const dgMatrix& inertia)
{
dgFloat32 Ixx = inertia[0][0];
dgFloat32 Iyy = inertia[1][1];
dgFloat32 Izz = inertia[2][2];
mass = dgAbs (mass);
if (m_collision->IsType(dgCollision::dgCollisionMesh_RTTI) || m_collision->IsType(dgCollision::dgCollisionScene_RTTI)) {
mass = DG_INFINITE_MASS * 2.0f;
}
if (m_collision->IsType(dgCollision::dgCollisionCompound_RTTI)) {
const dgCollision* const childShape = m_collision->GetChildShape();
if ((childShape->m_inertia.m_x < dgFloat32 (1.0e-5f)) || (childShape->m_inertia.m_y < dgFloat32 (1.0e-5f)) || (childShape->m_inertia.m_z < dgFloat32 (1.0e-5f))){
mass = DG_INFINITE_MASS * 2.0f;
}
}
> newton.dll!dgBody::SetMassMatrix(float mass, const dgMatrix & inertia) Line 470 C++
newton.dll!dgWorld::InitBody(dgBody * const body, dgCollisionInstance * const collision, const dgMatrix & matrix) Line 453 C++
newton.dll!dgWorld::CreateDynamicBody(dgCollisionInstance * const collision, const dgMatrix & matrix) Line 492 C++
newton.dll!NewtonCreateDynamicBody(const NewtonWorld * const newtonWorld, const NewtonCollision * const collisionPtr, const float * const matrixPtr) Line 4318 C++
Urho3D.dll!Urho3D::NewtonRigidBody::reBuildBody() Line 257 C++
Urho3D.dll!Urho3D::NewtonRigidBody::reBuildBodyParent() Line 164 C++
MeltingPlastic wrote:I'm adding faces to the mesh manually face by face so I cant imagine how I would be feeding bad data or anything. (I have checked the data - that works fine)
If things are working you should be able to hold space and see what is in the first picture in this thread.
Posted new demo with the trace instead of the assert in the other thread.
> newton.dll!dgCollisionCompound::dgCollisionCompound(dgWorld * const world) Line 474 C++
newton.dll!dgWorld::CreateCompound() Line 241 C++
newton.dll!NewtonCreateCompoundCollision(const NewtonWorld * const newtonWorld, int shapeID) Line 2441 C++
Urho3D.dll!Urho3D::NewtonRigidBody::reBuildBody() Line 197 C++
Urho3D.dll!Urho3D::NewtonRigidBody::reBuildBodyParent() Line 164 C++
MeltingPlastic wrote:Although I am a little confused as to why it wasn't working. Here is a question, does NewtonCollisionCreateInstance create a new "deep copied" compound collision if it is given one?
Users browsing this forum: No registered users and 1 guest