| 1578 | } |
| 1579 | |
| 1580 | void ShapeBase::updateContainer() |
| 1581 | { |
| 1582 | PROFILE_SCOPE( ShapeBase_updateContainer ); |
| 1583 | |
| 1584 | // Update container drag and buoyancy properties |
| 1585 | |
| 1586 | // Set default values. |
| 1587 | mDrag = mDataBlock->drag; |
| 1588 | mBuoyancy = 0.0f; |
| 1589 | mGravityMod = 1.0; |
| 1590 | mAppliedForce.set(0,0,0); |
| 1591 | |
| 1592 | ContainerQueryInfo info; |
| 1593 | info.box = getWorldBox(); |
| 1594 | info.mass = getMass(); |
| 1595 | |
| 1596 | mContainer->findObjects(info.box, WaterObjectType|PhysicalZoneObjectType,findRouter,&info); |
| 1597 | |
| 1598 | mWaterCoverage = info.waterCoverage; |
| 1599 | mLiquidType = info.liquidType; |
| 1600 | mLiquidHeight = info.waterHeight; |
| 1601 | setCurrentWaterObject( info.waterObject ); |
| 1602 | |
| 1603 | // This value might be useful as a datablock value, |
| 1604 | // This is what allows the player to stand in shallow water (below this coverage) |
| 1605 | // without jiggling from buoyancy |
| 1606 | if (mWaterCoverage >= 0.25f) |
| 1607 | { |
| 1608 | // water viscosity is used as drag for in water. |
| 1609 | // ShapeBaseData drag is used for drag outside of water. |
| 1610 | // Combine these two components to calculate this ShapeBase object's |
| 1611 | // current drag. |
| 1612 | mDrag = ( info.waterCoverage * info.waterViscosity ) + |
| 1613 | ( 1.0f - info.waterCoverage ) * mDataBlock->drag; |
| 1614 | mBuoyancy = (info.waterDensity / mDataBlock->density) * info.waterCoverage; |
| 1615 | } |
| 1616 | |
| 1617 | mAppliedForce = info.appliedForce; |
| 1618 | mGravityMod = info.gravityScale; |
| 1619 | |
| 1620 | //Con::printf( "WaterCoverage: %f", mWaterCoverage ); |
| 1621 | //Con::printf( "Drag: %f", mDrag ); |
| 1622 | } |
| 1623 | |
| 1624 | |
| 1625 | //---------------------------------------------------------------------------- |
nothing calls this directly
no test coverage detected