private void EnforceMinimumDynamicDimensions() { PhysX.Bounds3 bounds = _actor.WorldBounds; float xsz = bounds.Extents.X * 2.0f; float ysz = bounds.Extents.Y * 2.0f; float zsz = bounds.Extents.Z * 2.0f; //prevent the creation of esentially 1 dimensional physicals int dimsTooSmall = 0; if (xsz < MIN_SIZE_FOR_DYNAMIC) { dimsTooSmall++; } if (ysz < MIN_SIZE_FOR_DYNAMIC) { dimsTooSmall++; } if (zsz < MIN_SIZE_FOR_DYNAMIC) { dimsTooSmall++; } if (dimsTooSmall >= 2) { //object is too small to be dynamic. set kinematic _isPhysical = false; _dynActor.Flags = _dynActor.Flags | PhysX.RigidDynamicFlags.Kinematic; } }
private void EnforceMaximumDynamicDimensions() { PhysX.Bounds3 bounds = _actor.WorldBounds; float xsz = bounds.Extents.X * 2.0f; float ysz = bounds.Extents.Y * 2.0f; float zsz = bounds.Extents.Z * 2.0f; //prevent ridiculous sized dynamics if (xsz > MAX_PHSYICAL_DIMENSION * 2.0f || ysz > MAX_PHSYICAL_DIMENSION * 2.0f || zsz > MAX_PHSYICAL_DIMENSION * 2.0f) { //object is too large to be dynamic. set kinematic _isPhysical = false; _dynActor.Flags = _dynActor.Flags | PhysX.RigidDynamicFlags.Kinematic; return; } int dimsTooLarge = 0; if (xsz > MAX_PHSYICAL_DIMENSION) { dimsTooLarge++; } if (ysz > MAX_PHSYICAL_DIMENSION) { dimsTooLarge++; } if (zsz > MAX_PHSYICAL_DIMENSION) { dimsTooLarge++; } if (dimsTooLarge >= 2) { //object is too large to be dynamic. set kinematic _isPhysical = false; _dynActor.Flags = _dynActor.Flags | PhysX.RigidDynamicFlags.Kinematic; return; } }