static void BuildFloorAndSceneRoot (SceneManager& system) { NewtonWorld* world; RenderPrimitive* floor; NewtonBody* floorBody; NewtonCollision* floorCollision; OGLMesh* meshInstance; world = system.m_world; // ///////////////////////////////////////////////////////////////////// // // create the sky box, system.AddModel (new SkyBox ()); // create the the floor graphic objects dVector floorSize (100.0f, 2.0f, 100.0f); dMatrix location (GetIdentityMatrix()); location.m_posit.m_y = -5.0f; // create a box for floor floorCollision = NewtonCreateBox (world, floorSize.m_x, floorSize.m_y, floorSize.m_z, 0, NULL); // meshInstance = OGLMesh::MakeBox (world, size.m_x, size.m_y, size.m_z, "GrassAndDirt.tga"); meshInstance = new OGLMesh (floorCollision, "GrassAndDirt.tga", "metal_30.tga", "metal_30.tga"); floor = new RenderPrimitive (location, meshInstance); system.AddModel (floor); meshInstance->Release(); // create the the floor collision, and body with default values floorBody = NewtonCreateBody (world, floorCollision); NewtonReleaseCollision (world, floorCollision); // set the transformation for this rigid body NewtonBodySetMatrix (floorBody, &location[0][0]); // save the pointer to the graphic object with the body. NewtonBodySetUserData (floorBody, floor); // set a destructor for this rigid body NewtonBodySetDestructorCallback (floorBody, PhysicsBodyDestructor); // get the default material ID int defaultID; defaultID = NewtonMaterialGetDefaultGroupID (world); // set default material properties NewtonMaterialSetDefaultSoftness (world, defaultID, defaultID, 0.05f); NewtonMaterialSetDefaultElasticity (world, defaultID, defaultID, 0.4f); NewtonMaterialSetDefaultCollidable (world, defaultID, defaultID, 1); NewtonMaterialSetDefaultFriction (world, defaultID, defaultID, 1.0f, 0.5f); NewtonMaterialSetCollisionCallback (world, defaultID, defaultID, NULL, NULL, GenericContactProcess); // NewtonMaterialSetSurfaceThickness(world, materialID, materialID, 0.1f); NewtonMaterialSetSurfaceThickness(world, defaultID, defaultID, 0.0f); // set the island update callback NewtonSetIslandUpdateEvent (world, PhysicsIslandUpdate); // save the callback SetDemoCallbacks (system); InitEyePoint (dVector (1.0f, 0.0f, 0.0f), dVector (-40.0f, 10.0f, 0.0f)); }
void PhysWorld3D::SetMaterialSurfaceThickness(int firstMaterial, int secondMaterial, float thickness) { NewtonMaterialSetSurfaceThickness(m_world, firstMaterial, secondMaterial, thickness); }