Skip to content

Commit

Permalink
Add gravity alignment radius override
Browse files Browse the repository at this point in the history
  • Loading branch information
xen-42 committed Nov 10, 2024
1 parent 8924811 commit a469023
Show file tree
Hide file tree
Showing 2 changed files with 6 additions and 1 deletion.
2 changes: 1 addition & 1 deletion NewHorizons/Builder/General/GravityBuilder.cs
Original file line number Diff line number Diff line change
Expand Up @@ -47,7 +47,7 @@ public static GravityVolume Make(GameObject planetGO, AstroObject ao, OWRigidbod
var alignmentRadius = config.Atmosphere?.clouds?.outerCloudRadius ?? 1.5f * config.Base.surfaceSize;
if (config.Base.surfaceGravity == 0) alignmentRadius = 0;

gravityVolume._alignmentRadius = alignmentRadius;
gravityVolume._alignmentRadius = config.Base.gravityAlignmentRadiusOverride ?? alignmentRadius;
gravityVolume._upperSurfaceRadius = config.Base.surfaceSize;
gravityVolume._lowerSurfaceRadius = 0;
gravityVolume._layer = 3;
Expand Down
5 changes: 5 additions & 0 deletions NewHorizons/External/Modules/BaseModule.cs
Original file line number Diff line number Diff line change
Expand Up @@ -70,6 +70,11 @@ public class BaseModule
/// </summary>
[DefaultValue(0)] public int gravityVolumePriority = 0;

/// <summary>
/// Optional. Overrides how far the player must be from the planet for their feet to automatically orient towards the ground.
/// </summary>
public int? gravityAlignmentRadiusOverride = null;

/// <summary>
/// Apply physics to this planet when you bump into it. Will have a spherical collider the size of surfaceSize.
/// For custom colliders they have to all be convex and you can leave surface size as 0.
Expand Down

0 comments on commit a469023

Please sign in to comment.