| 1717 | } |
| 1718 | |
| 1719 | void ShapeBase::updateContainer() |
| 1720 | { |
| 1721 | PROFILE_SCOPE( ShapeBase_updateContainer ); |
| 1722 | |
| 1723 | // Update container drag and buoyancy properties |
| 1724 | |
| 1725 | // Set default values. |
| 1726 | mDrag = mDataBlock->drag; |
| 1727 | mBuoyancy = 0.0f; |
| 1728 | mNetGravity = gGravity; |
| 1729 | mAppliedForce.set(0,0,0); |
| 1730 | |
| 1731 | ContainerQueryInfo info; |
| 1732 | info.box = getWorldBox(); |
| 1733 | info.mass = getMass(); |
| 1734 | |
| 1735 | mContainer->findObjects(info.box, WaterObjectType|PhysicalZoneObjectType,findRouter,&info); |
| 1736 | |
| 1737 | mWaterCoverage = info.waterCoverage; |
| 1738 | mLiquidType = info.liquidType; |
| 1739 | mLiquidHeight = info.waterHeight; |
| 1740 | setCurrentWaterObject( info.waterObject ); |
| 1741 | |
| 1742 | // This value might be useful as a datablock value, |
| 1743 | // This is what allows the player to stand in shallow water (below this coverage) |
| 1744 | // without jiggling from buoyancy |
| 1745 | if (mWaterCoverage >= 0.25f) |
| 1746 | { |
| 1747 | // water viscosity is used as drag for in water. |
| 1748 | // ShapeBaseData drag is used for drag outside of water. |
| 1749 | // Combine these two components to calculate this ShapeBase object's |
| 1750 | // current drag. |
| 1751 | mDrag = ( info.waterCoverage * info.waterViscosity ) + |
| 1752 | ( 1.0f - info.waterCoverage ) * mDataBlock->drag; |
| 1753 | mBuoyancy = (info.waterDensity / mDataBlock->density) * info.waterCoverage; |
| 1754 | } |
| 1755 | |
| 1756 | mAppliedForce = info.appliedForce; |
| 1757 | mNetGravity = (1.0-mBuoyancy)*info.gravityScale* gGravity; |
| 1758 | |
| 1759 | //Con::printf( "WaterCoverage: %f", mWaterCoverage ); |
| 1760 | //Con::printf( "Drag: %f", mDrag ); |
| 1761 | } |
| 1762 | |
| 1763 | |
| 1764 | //---------------------------------------------------------------------------- |
nothing calls this directly
no test coverage detected