Gravity Zones
Zones that alter a floater's gravity source.
How Gravity Zones Work
All GravityZones must have a trigger collider attached to the script object.
When a Floater enters a GravityZone, the GravityZone is added to the stack of influencing GravityZones.
Only the most recent GravityZone entered will be the zone exerting it's force on the Floater.
If a Floater leaves a GravityZone, it will revert to the previous GravityZone it was in.
Float Volume Gravity Settings
FloatVolumes should have the "Water Gravity Zone" set to their respective gravity zone.
If you are using GravityZoneFlat, set Dynamic Gravity Direction to true on the FloatVolume.
FloatVolumes will auto detect if a sphere or capsule collider is being used as the FloatVolume trigger and will automatically perform the correct water height calculations.
Some GravityZones require additional settings to be turned on for FloatVolumes, see details for each zone type below.
Included Gravity Zones
GravityZoneFlatApplies gravity downward based on the zone's rotation.
Useful for water walls and ceilings.
For
FloatVolumesusing this Gravity Zone:Set
Dynamic Gravity Directionto true.
GravityZoneSphereThe "Gravity Center" transform should be located in the center of the sphere.
Toggle on the "Is Concave" option to make the gravity push outwards from the center.
GravityZoneCapsuleToggle on the "Is Concave" option to make the gravity push outwards from the center.
Warning: If you want to increase the size of the capsule, the collider of the capsule will be the actual size of the zone and not the visual mesh of the capsule. Capsule colliders scale very differently compared to all other colliders. If you want to adjust the length or radius of a capsule collider, you will have to create a custom mesh to visually match the trigger size of the zone.
GravityZoneRampApplies a cylinder's gravity to create a ramp like effect.
The "Gravity Center" transform must be located in the center of the cylinder AND must be rotated to have the Y-axis pointing in the direction of the cylinder.
Toggle on the "Is Concave" option to make the gravity push outwards from the center.
Creating Custom Gravity Zones
Create a new script and inherit from the
GravityZoneclass.Implement the
GetGravityForceandSetGravityIntensityoverride functions.GetGravityForceshould do all your calculations you wish the gravity zone to performSetGravityIntensityis for updating the gravity intensity, which can trigger recalculations of variables if desired.
Last updated