void cMaterialSelector::resetToDefault() { SetMaterialIndex(defaultValue); // emit valueChanged(defaultValue); }
// UNEXPOSED void CPhysicsObject::Init(CPhysicsEnvironment *pEnv, btRigidBody *pObject, int materialIndex, objectparams_t *pParams, bool isStatic, bool isSphere) { m_pEnv = pEnv; m_pObject = pObject; m_bIsSphere = isSphere; m_gameFlags = 0; m_fMass = (pParams && !isStatic) ? pParams->mass : 0; m_pGameData = NULL; m_pName = NULL; m_fVolume = 0; m_callbacks = CALLBACK_GLOBAL_COLLISION | CALLBACK_GLOBAL_FRICTION | CALLBACK_FLUID_TOUCH | CALLBACK_GLOBAL_TOUCH | CALLBACK_GLOBAL_COLLIDE_STATIC | CALLBACK_DO_FLUID_SIMULATION; m_iLastActivationState = -1; m_pObject->setUserPointer(this); m_pObject->setSleepingThresholds(SLEEP_LINEAR_THRESHOLD, SLEEP_ANGULAR_THRESHOLD); m_pObject->setActivationState(ISLAND_SLEEPING); // All objects start asleep. if (pParams) { m_pGameData = pParams->pGameData; m_pName = pParams->pName; m_fVolume = pParams->volume * CUBIC_METERS_PER_CUBIC_INCH; EnableCollisions(pParams->enableCollisions); m_pObject->setDebugName(m_pName); } SetMaterialIndex(materialIndex); SetContents(MASK_SOLID); // Compute our air drag values. float drag = 0; float angDrag = 0; if (pParams) { drag = pParams->dragCoefficient; angDrag = pParams->dragCoefficient; } if (isStatic || !GetCollide()) { drag = 0; angDrag = 0; } ComputeDragBasis(isStatic); if (!isStatic && drag != 0.0f) { EnableDrag(true); } m_dragCoefficient = drag; m_angDragCoefficient = angDrag; // Compute our continuous collision detection stuff (for fast moving objects, prevents tunneling) // This doesn't work on compound objects! see: btDiscreteDynamicsWorld::integrateTransforms if (!isStatic) { btVector3 mins, maxs; m_pObject->getCollisionShape()->getAabb(btTransform::getIdentity(), mins, maxs); mins = mins.absolute(); maxs = maxs.absolute(); float maxradius = min(min(maxs.getX(), maxs.getY()), maxs.getZ()); float minradius = min(min(mins.getX(), mins.getY()), mins.getZ()); float radius = min(maxradius, minradius); m_pObject->setCcdMotionThreshold((radius / 2) * (radius / 2)); m_pObject->setCcdSweptSphereRadius(0.7f * radius); } if (isStatic) { m_pObject->setCollisionFlags(m_pObject->getCollisionFlags() | btCollisionObject::CF_STATIC_OBJECT); m_pEnv->GetBulletEnvironment()->addRigidBody(m_pObject, COLGROUP_WORLD, ~COLGROUP_WORLD); } else { m_pEnv->GetBulletEnvironment()->addRigidBody(m_pObject); } }