Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Add buoyancy and density properties to water #489

Merged
merged 2 commits into from
Jan 17, 2023
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
2 changes: 2 additions & 0 deletions NewHorizons/Builder/Body/WaterBuilder.cs
Original file line number Diff line number Diff line change
Expand Up @@ -114,6 +114,8 @@ public static void Make(GameObject planetGO, Sector sector, OWRigidbody rb, Wate
fluidVolume._attachedBody = rb;
fluidVolume._triggerVolume = buoyancyTriggerVolume;
fluidVolume._radius = waterSize;
fluidVolume._buoyancyDensity = module.buoyancy;
fluidVolume._density = module.density;
fluidVolume._layer = LayerMask.NameToLayer("BasicEffectVolume");

var fogGO = GameObject.Instantiate(_oceanFog, waterGO.transform);
Expand Down
13 changes: 12 additions & 1 deletion NewHorizons/External/Modules/VariableSize/WaterModule.cs
Original file line number Diff line number Diff line change
@@ -1,5 +1,6 @@
using NewHorizons.Utility;
using NewHorizons.Utility;
using Newtonsoft.Json;
using System.ComponentModel;

namespace NewHorizons.External.Modules.VariableSize
{
Expand All @@ -11,6 +12,16 @@ public class WaterModule : VariableSizeModule
/// </summary>
public float size;

/// <summary>
/// Density of the water sphere. The higher the density, the harder it is to go through this fluid.
/// </summary>
[DefaultValue(1.2f)] public float density = 1.2f;

/// <summary>
/// Buoyancy density of the water sphere
/// </summary>
[DefaultValue(1f)] public float buoyancy = 1f;

/// <summary>
/// Tint of the water
/// </summary>
Expand Down
12 changes: 12 additions & 0 deletions NewHorizons/Schemas/body_schema.json
Original file line number Diff line number Diff line change
Expand Up @@ -2573,6 +2573,18 @@
"description": "Size of the water sphere",
"format": "float"
},
"density": {
"type": "number",
"description": "Density of the water sphere. The higher the density, the harder it is to go through this fluid.",
"format": "float",
"default": 1.2
},
"buoyancy": {
"type": "number",
"description": "Buoyancy density of the water sphere",
"format": "float",
"default": 1.0
},
"tint": {
"description": "Tint of the water",
"$ref": "#/definitions/MColor"
Expand Down