void CPhysicsObject::OutputDebugInfo() const { Msg("-----------------\n"); if (m_pName) Msg("Object: %s\n", m_pName); Msg("Mass: %f (inv %f)\n", GetMass(), GetInvMass()); Vector pos; QAngle ang; GetPosition(&pos, &ang); Msg("Position: %f %f %f\nAngle: %f %f %f\n", pos.x, pos.y, pos.z, ang.x, ang.y, ang.z); Vector inertia = GetInertia(); Vector invinertia = GetInvInertia(); Msg("Inertia: %f %f %f (inv %f %f %f)\n", inertia.x, inertia.y, inertia.z, invinertia.x, invinertia.y, invinertia.z); Vector vel; AngularImpulse angvel; GetVelocity(&vel, &angvel); Msg("Velocity: %f, %f, %f\nAng Velocity: %f, %f, %f\n", vel.x, vel.y, vel.z, angvel.x, angvel.y, angvel.z); float dampspeed, damprot; GetDamping(&dampspeed, &damprot); Msg("Damping %f linear, %f angular\n", dampspeed, damprot); Vector dragBasis; Vector angDragBasis; ConvertPosToHL(m_dragBasis, dragBasis); ConvertDirectionToHL(m_angDragBasis, angDragBasis); Msg("Linear Drag: %f, %f, %f (factor %f)\n", dragBasis.x, dragBasis.y, dragBasis.z, m_dragCoefficient); Msg("Angular Drag: %f, %f, %f (factor %f)\n", angDragBasis.x, angDragBasis.y, angDragBasis.z, m_angDragCoefficient); // TODO: Attached to x controllers Msg("State: %s, Collision %s, Motion %s, Drag %s, Flags %04X (game %04x, index %d)\n", IsAsleep() ? "Asleep" : "Awake", IsCollisionEnabled() ? "Enabled" : "Disabled", IsStatic() ? "Static" : IsMotionEnabled() ? "Enabled" : "Disabled", IsDragEnabled() ? "Enabled" : "Disabled", m_pObject->getFlags(), GetGameFlags(), GetGameIndex() ); const char *pMaterialStr = g_SurfaceDatabase.GetPropName(m_materialIndex); surfacedata_t *surfaceData = g_SurfaceDatabase.GetSurfaceData(m_materialIndex); if (surfaceData) { Msg("Material: %s : density(%f), thickness(%f), friction(%f), elasticity(%f)\n", pMaterialStr, surfaceData->physics.density, surfaceData->physics.thickness, surfaceData->physics.friction, surfaceData->physics.elasticity); } Msg("-- COLLISION SHAPE INFO --\n"); g_PhysicsCollision.OutputDebugInfo((CPhysCollide *)m_pObject->getCollisionShape()->getUserPointer()); }
Grenade::Grenade(const TVector2D& src, const TVector2D& velocity, unsigned int _owner) : m_iOwner(_owner), m_iCurrentFrame(0), m_fTimerChangeFrame(0.0f), m_bPlayOnlyOnce(true), m_fTimerThrow(world.getCurrentTime), killMyself(false) { m_xTexture = &WeaponManager::GetSingleton().text_grenade[0]; m_fHalfHeight = m_xTexture->h/2.0f; m_fHalfWidth = m_xTexture->w/2.0f; Set(src, velocity, 8, m_fHalfHeight, m_fHalfWidth, 0.01f); SetCollisionCallback(HandleContact); GetInvInertia() = 0.0f; GetInertia() = 0.0f; GetAngVelocity() = 0.0f; SetOrientation(0.0f); type = TYPE_GRENADE; }